Loading a external swf then go to a specific frame????
Copy link to clipboard
Copied
Hello I'm made a dropdown menu and i have resolved the navigation for the main buttons, but i have problems with the menu sub buttons , my question is:
After the movie is loaded, how can i make the sub button go to specific frame.
This is the script:
nosotros.addEventListener(MouseEvent.CLICK, clickmouse);//main button
historia.addEventListener(MouseEvent.CLICK, goSub);// sub button
var myLoader:Loader;
function goSub(evt:MouseEvent):void {
trace("clickSub")
MovieClip(parent).gotoAndStop("historia");
}
function clickmouse(evt:MouseEvent):void {
trace("clickMain")
myLoader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, onLoaded);
myLoader.load(new URLRequest("swf/"+evt.target.name+".swf"));
//var url:URLRequest = new URLRequest("swf/"+evt.target.name+".swf")
}
function onLoaded(evt:Event):void {
parent[ "container" ].removeChildAt(0);
parent[ "container" ].addChild(myLoader);
myLoader = null;
}
And Appears...
ArgumentError: Error #2109: Frame label historia not found in scene Scene 1.
at flash.display::MovieClip/gotoAndStop()
at HomeSonny_fla::menu_2/goSub()
Project files into the zip,the script is into the menu instance in the HomeSonny.fla file...
thanks for watching...
Copy link to clipboard
Copied
I assume you're using CS4? Frame labels have always worked fine for me up through CS3. As soon as I installed CS4, most of my files with frame labels no longer work. And there appears to be no way around it.
The only way frame labels seem to work is if you have one simple scene and frame labels are on the main timeline only.
It's irritating.
Now, with that being said, I do have ONE file that still seems to be working fine in CS4.
The code I used is this:
(getChildByName(movieClipName) as MovieClip).gotoAndStop("DISABLED");
If that line of code doesn't work, try using frame numbers instead of frame labels.
By the way, I tried to open your .zip file and I get two Windows error messages... 1 message says the archive is empty and the other message says the archive is corrupted.
Copy link to clipboard
Copied
Thank you for your help, this is teh answer:
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("external.swf");
ldr.load(urlReq);
function loadHandler (e:Event) {
var myClip:MovieClip = e.target.content;
addChild(myClip);
///////////////////////////////////////////////////////////////
function clickSub(e:MouseEvent):void {
myClip.nosotrosmc.gotoAndStop(e.target.name);
//myClip.islasmc.gotoAndStop(e.target.name);
}
// set listeners subButtons
button.addEventListener(MouseEvent.MOUSE_UP, clickSub);
}
// listener
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
Copy link to clipboard
Copied
hello i have problem with loaded swf. instance names, in as2 i can acces instance name of loaded swf with loadmovie.
i loaded my p1.swf into root / ana / ic i have instance name in pr1.swf "sayfa"
when load finished i cannt acces my sayfa movile root.ana.ic.sayfa is null. how can acces sayfa from main swf?
my code here.
var i =new Loader();
i.load(new URLRequest("p1.swf"));
while( ic.numChildren > 0 )
ic.removeChildAt( 0 );
ic.addChild(i);
Copy link to clipboard
Copied
check this:
http://www.youtube.com/watch?v=P7n2XtnhKoU&feature=channel

