Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : when are objects available


continuity
3/23/2004 11:37:01 PM
I have a hand-built component... basically it is a movie clip continaing a
'label' text field and an 'input' text field... there are also some built in
methods so that I can change the 'input' text field to dynamic, change it's
text, run some validation etc... a page of these components make up an iput
screen for part of a flash database app...

the issue I have is that of timing... app enters a frame when some of these
guys exist, and some action script tries to access the methods to set the text
in the component... the problem is that the action script fires before the
components are instatiated on the timeline...

how does flash know when all the components are on the timeline... is there
some way around this...

continuity
kglad
3/24/2004 1:20:23 AM
continuity
3/24/2004 2:35:12 AM
I must be doing something wrong then... any advice would be appreciated...
could you please look at the attachment, keeping in mind I still have to
struggle with Flash MX (boss won't upgrade us yet)


ta

continuity
kglad
3/24/2004 2:39:07 AM
continuity
3/24/2004 2:50:20 AM
kglad
3/24/2004 3:12:25 AM
rats. i don't know why i can't dl that file. my email address is: kglad @ nospam
kglad
3/24/2004 4:33:00 AM
when you use #initclip for a movieclip, the actionscript will be executed
before any frame actions attached to the frame in which your movieclip is
instantiated (unless you export in the first frame, as in your situation, so
this actionscript will execute before any frame actions in the first frame).
exporting, in your situation, plays no role in the order of code execution
because your movieclip is in frame 1 of the main timeline.

the order parameter (#initclip order) only has meaning if you have more than
one movieclip being instantiated on the same frame and you want to specify the
order of code initialization. it'll have no meaning in your script because
both blocks are attached to the same movieclip. the block attached to the
topmost layer will execute before the block in the lower layer no matter what
order parameter you specify.

while both blocks of code in your movieclip execute before any code in frame 1
of the main timeline, your onLoad event will only fire after code in frame 1 of
the main timeline executes, because code executes before the stage is updated.
only after the stage is updated does your movieclip load and therefore only
after frame 1 code in the main timeline executes will your onLoad event fire.
note: this code has executed already, it just won't fire.
continuity
3/24/2004 11:23:24 PM
thankyou... I changed the onload event for a made-up function name and called
that function from the construction function...

function StdTextField() {this.init();}

now it works as I would expect... the methods are available before the actions
call them...

continuity

kglad
3/24/2004 11:55:23 PM
AddThis Social Bookmark Button