PDA

View Full Version : Error #1009 - Help me



allnaturalscott
September 25th, 2007, 04:16 PM
Hey guys, I have a button that calls the following code which sends the playhead to the next frame and tells the scrollbars to work properly. However, I keep getting this Error #1009 saying its a null object im trying to call...I know the object is there, it works on the first frame (before you click the button below to go to the next frame), it just does not register before flash sends off all these commands.

I tried putting all of the code on the frame that it jumps to, but I cant get the code to work there because it calls things from the package that it cant reach.

Im so lost, please, any ideas would be so great. thanks!




protected function rightClick(e:MouseEvent):void
{

holder_mc.gotoAndStop(2);

holder_mc.links_mc.rollOver1_mc.visible = false;
holder_mc.links_mc.rollOver2_mc.visible = false;
holder_mc.links_mc.rollOver3_mc.visible = false;
_scrollbar2 = new CustomScrollBar(holder_mc.links_mc.rollOver3_mc.al pha_mc.txt1_mc, holder_mc.links_mc.rollOver3_mc.alpha_mc.mask_mc, holder_mc.links_mc.rollOver3_mc.scrub_mc);
_scrollbar2.scrubBounds = new Rectangle(holder_mc.links_mc.rollOver3_mc.scrub_mc .x, holder_mc.links_mc.rollOver3_mc.scrub_mc.y, 0, holder_mc.links_mc.rollOver3_mc.down_btn.y - holder_mc.links_mc.rollOver3_mc.scrub_mc.y - holder_mc.links_mc.rollOver3_mc.scrub_mc.height - 1);
_scrollbar2.showGear();
}

SlowRoasted
September 25th, 2007, 06:02 PM
You are probably going to have to post your FLA.

allnaturalscott
September 25th, 2007, 06:05 PM
Actually, I sort of have it figured out.

I am calling something that rests on the frame the same action sends the playhead to...however, it is trying to use the object before the playhead reaches that spot, so its considered NULL and sends Error #1009.

What I need to figure out is, how do I get the functions to not trigger until the stuff is there.

cesig
September 25th, 2007, 06:05 PM
If the object is in a new keyframe on frame 2 then the reason it's registering as null is because Flash needs more time to index the contents of the frame before anything within it is available.

If you don't think this is right, post your fla and we can probably help better.

EDIT: beaten to the answer

cesig
September 25th, 2007, 06:08 PM
This problems sucks, and I hope it gets fixed eventually. In the meantime, the only real solution I've found is to put the object on the stage prior to needing it. Then control the visibility within the code. This way, it'll be available, but invisible.

Hope this helps.

allnaturalscott
September 25th, 2007, 06:18 PM
Well,

just in case someone can figure it out, I've uploaded my source.

http://theliftbranding.com/salerno/test.zip

inside the library select "models" from the models folder...goto about frame 30 and open "holder_mc" the gallery MC on the page.

see, when you click the right arrow, it sends to the next frame, and SHOULD use the code on the next frame (within holder_mc) to make the scrollbar work, but it throws errors. =\

any ideas? you should notice that the scrollbars im refering to are hidden until you click features or price above...it works on the first one, thats done onAdd..but not the rest.

allnaturalscott
September 25th, 2007, 06:19 PM
how might i do that easily within the current framework of my file? its sorta impossible to do that because im using duplicate names i think... =\