MegaZine3 Version 1 ("The Old One") > General Discussion
action script interactions between pages
stopwind:
Hi all! I'm new to Megazine 3. Now I am trying to create some interactions between separated pages, for example:
Put some buttons on the Left page, and when you press a button, the image on the Right page will be changed.
Currently I'm using v1.38, and followed the tutorial to get the swf by ID:
var element:AbstractElement = mz.getElementById("newTrend_R").element;
var swf:DisplayObject = element.swf;
However, I got compilation error "Access of possibly undefined property swf..."
Does anyone got this problem too? Thanks a lot in advance!
Another question is if I put some movie clips on the Right page, can I call something like:
swf.setChildIndex(movieClip_1, topLayer)
when the button on the Left page is pressed to get the effect I mentioned in the example? Thanks again! ;)
Florian Nücke:
To get around the compiler warning/error:
--- Code: (actionscript3) ---var element:AbstractElement = mz.getElementById("newTrend_R").element;var swf:DisplayObject = element["swf"];
Or switch to 2.0 and use the IImg interface ;)
The setChildIndex works on the children of the loaded swf, so if that's what you want, that should be fine. The z-index of actual page elements cannot be changed.
Overall alternative: use 2.0 and make it spreadpage, so you have it all in one swf ;)
stopwind:
Brilliant! :D I can setup the interaction between swf files!
Thanks a lot! ;D will definitely try out 2.0 ;D
cduchesne:
Has a new tutorial been written for Actionscript Interaction in version 2.0?
I need to pass a variable chosen in a swf from one page to the next. Essentially, it's a story book and the user chooses between a slow or fast version.
Do we use this new IImg interface and if so, how does it get called? The API seems to just list the possibilities, but doesn't explain how to use them.
Or do we keep using getElementById, which now seems to be part of a new plugin elementids?
Or is there another, simpler way to pass variables from one page to the next?
thanks!
Florian Nücke:
You're on the right track with the plugin ;)
I adjusted the original tutorial when moving it to the project wiki, so this one is for v2:
http://megazine.mightypirates.de/wiki/index.php/ActionScript_Interaction
Navigation
[0] Message Index
[#] Next page
Go to full version