[FONT=Courier New][LEFT][COLOR=#808080]*[COLOR=Black]taken from this link:
[/COLOR]// symbol_mc is a movie clip symbol in the library.[/COLOR]
[COLOR=#808080]// It is linked to the MovieClip class.[/COLOR]
[COLOR=#808080]// The following function is triggered for each instance of symbol_mc*[/COLOR]
[COLOR=#808080]// when it receives data.[/COLOR]
symbol_mc.[COLOR=#0000ff]onData[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“The movie clip has received data”[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]// dynamic_mc is a movie clip that is being loaded with MovieClip.loadMovie().[/COLOR]
[COLOR=#808080]// This code attempts to call a function when the clip is loaded, [/COLOR]
[COLOR=#808080]// but it will not work, because the loaded SWF is not a symbol[/COLOR]
[COLOR=#808080]// in the library associated with the MovieClip class.[/COLOR]
[COLOR=#000000]function[/COLOR] outputCOLOR=#000000[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“Will never be called.”[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
dynamic_mc.[COLOR=#0000ff]onData[/COLOR] = output;
dynamic_mc.[COLOR=#0000ff]loadMovie[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#808080]// The following function is invoked for any movie clip that[/COLOR]
[COLOR=#808080]// receives data, whether it is in the library or not.[/COLOR]
[COLOR=#808080]// Therefore, this function is invoked when symbol_mc is instantiated [/COLOR]
[COLOR=#808080]// and also when replacement.swf is loaded.[/COLOR]
[COLOR=#0000ff]OnClipEvent[/COLOR][COLOR=#000000]([/COLOR] [COLOR=#0000ff]data[/COLOR] [COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“The movie clip has received data”[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}
My problem: I am attaching variable number of MCs dynamically(not in the library), and i have to do so using flash6 or older. How can i use then loadMovie+onClipEvent handler to invoke something, if i am attaching MCs dynamically, and onClipEvent works only on MCs attached on the Stage(actions “on” those mcs, not “inside” them). Probably using classes. Any other option? and if not, can[/COLOR][FONT=Courier New][COLOR=#000000] anybody[/COLOR][/FONT][COLOR=#000000] guide me through assigning such class to such mc?
EDIT: Ok, i also have done following:
for(i=0; i<aPics.length; i++){
mc = mcSlideShow.attachMovie("picHolder", "mc"+i, 100+i);
trace(mc.stop()); // EDIT2
mc.onData = function(){
trace("attached: "+this)
}
}
and although the movieClip IS in library, and it DOES have MovieClip class assigned, onData event handler is NOT triggered and nothing is traced. Can the reason be “attachMovie” function?
EDIT2: aha. well, again it happened that attachMovie’s methods are not yet initialized, so it was not yet “the proper time to assign” handler onData on those MCs. [only sen knows why :P]. So that even [/COLOR][FONT=Courier New][COLOR=#000000]trace(mc.stop()); at this point traces undefined, where it should trace [/COLOR][/FONT][COLOR=#000000][type Function], since stop is MovieClip’s class method. Stupidstupidstupid… relax…
gosh people, anybody does have a clue of a simple clean solution? I want to - basically - know, then the JPG file inside that MC was fully loaded, using loadMovie function, so that i can trigger a function [for each instance of that MC - each JPG, that is].
Thanks
[/COLOR] [/LEFT]
[/FONT]