flash question
- Started
- Last post
- 11 Responses
- jimv
I am trying to load an child swf into a parent swf in flash (2.0) I can load it but when it loads in is not on the top level and I am unable to interact with it, anybody have any ideas on how to fix this?
on (release) {
//load Movie Behavior
if(this._parent._parent.empty == Number(this._parent._parent.empt...
loadMovieNum("sprout-pong.swf",t...
} else {
this._parent._parent.empty.loadM...
}
//End Behavior}
- fyoucher10
Load it into a empty movieclip instead, then use swapDepths...
Create the empty mc dynamically, load SWF into it using the MovieClipLoader class, then target it how you typically would.Look up the MovieClipLoader class in the help file, I believe they actually have an exact example of what you're trying to do...
- taxiguerrilla0
... and then, before trying to interact with it, always check if the child movieclip is ready... an event like "complete" should be dispatched at the end of the loading.
- onLoadComplete (event for the MovieClipLoader class)fyoucher1
- hiatus0
I have a question, why do you get faster responses to quest. on QBn then Flashkit or Actionscript.org.
No one gets back to you on the forums. It seems crap. although they have great info/tuts and shit. :/
- jimv0
Have tried this but to no avail, can see SWF apear but stil no interaction with it.
on (release) {
this.createEmptyMovieClip("mytar... this.getNextHighestDepth());
mytarget1._lockroot = true;
mytarget1.loadMovie("sprout-pong...
}
- lvl_130
flashkit has been dead for years in my opinion. it got so bogged down with utter shit on there that it just makes the site crawlllllll.
i have found qbn to be quite helpful with flash questions, and i am very thankful for that :)
- fyoucher10
Sounds like a scope prob....can't see all of your code so I'm not exactly sure but...
You're heading in the right direction. Lets say you have a button in _root and you're using the code above. To target a movieclip inside of the loaded SWF from that button, you would use the following:mytarget1.myClip_mc.gotoAndPlay... //Example
Another thing to mention:
The clip has to be loaded before you can target it as taxiguerilla has mentioned. Does your loading code have to be attached to that button? You may be loading the SWF and then calling interaction code immediately after BUT the clip may not be loading yet.Another thing: instead of attaching code directly to the button, try this way instead:
- Give the button an instance name (i.e. myBig_btn)
- Add code to a separate layer in the timeline or external script (or a class file when you get into OOP).myBig_btn.onRelease = function():Void {
doThisAction(); //Example
}
- mikotondria30
in the swf that's being loaded just do a trace(this) and see what it thinks its really called when in context..
- hiatus0
i ♥ QBN. hug me back QBN! :D maybe its that x-mas spirit.
sorry about your swf file issue and ranting on it. :/
- jimv0
AHHHHH !!!!
I have been playing around with this for hours and I think I have regressed !! Intead of trying to load it as a SWF i am trying to load it as a _mc from the the library ... Great it apears on the stage and in the right position but still with no interaction with the game !! Any help on this one would be super dooper !!!
Thanks
May code currently stands at: When the Button is pressed,
on (release) {
emptygame.attachMovie('sprout-po... 0 );}
- sherm0
you gotta create the empty movie clip prior to the release event. it can't be within.
- jimv0
SORTED ...lockRoot was the key to the problem drop that in both the parent and child timeline and we were set to go...Thanks Everyone