Ozan Deniz
Ozan Deniz

Reputation: 135

(Flash-AS3)Why Main class doesn't see instance names which are directly written on the stage?

In Flash Professional CS6, one of my projects' main class doesn't see instance names directly written on object's property window, I haven't seen this problem before, it has to see my instance names. Does someone have any idea?

Upvotes: 0

Views: 308

Answers (2)

joshua
joshua

Reputation: 684

Returning (null) means it is not there, Some code how you have implemented it would be nice.. Here is an easy way to ensure your variables are global in flash,

Creat new flash file, create an empty movieClip "container" and make your whole project inside that MovieClip treating it as the main time line, put all you action script on the main stage timeline so when you reference something:

     container.myObject.x = 50 
     container.gotoAndStop(5); 

By doing this way everything is always available, I think its good practice as you NEVER need to worry about missing items, or variables. Also it makes it easier to move your project from project to project as all the content is inside the MovieClip(container) its a lot easier then re-copying frames on the main timeline..

Upvotes: 0

Vesper
Vesper

Reputation: 18757

Your gotoAndStop() statement does not immediately force Flash to change frames, so if these two statements of yours are coming one right after another, they are both executed in context of your previous frame, where Box1 is still null. You should use some primitive variables (int, String, maybe up to Array of something) to support data integrity when you travel between frames. These are to be initialized somewhere (in case of Array) and used throughout your timeline code.

Upvotes: 1

Related Questions