The wiki is primarily user oriented, not developer oriented. Have a look at the
API instead, where you'll see what dispatches what events and so on.
The engine is compiled to target 31 frames per second, I'm pretty sure this overrides the framerate for loaded content. The easiest solution for you would probably to recompile it with the same framerate you're working with (see the build.properties file in the ant folder of the project in the svn). I posted how to compile the sources not too long ago.
Now, the following is what
should work for
version 2.x not 1.x.
Note that I did not test this!
This one plays as soon as the page side containing the element is visible
import de.mightypirates.megazine.interfaces.IMegaZine;
import de.mightypirates.megazine.interfaces.IPageSide;
import de.mightypirates.utils.events.VisibilityEvent;
stop();
function megazineSetup(mz:IMegaZine, ps:IPageSide):void {
ps.addEventListener(VisibilityEvent.VISIBLE, handleVisible);
ps.addEventListener(VisibilityEvent.INVISIBLE, handleInvisible);
if (pageside.visible) {
play();
}
}
function handleVisible
(e
:Event):void { play();
}
function handleInvisible
(e
:Event):void { stop();
}
This one starts animations as soon as all animation is done and the containing page side is visible.
import de.mightypirates.megazine.interfaces.Constants;
import de.mightypirates.megazine.interfaces.IMegaZine;
import de.mightypirates.megazine.interfaces.IPageSide;
import de.mightypirates.megazine.events.MegaZineFlipStateChangeEvent;
stop();
var pageside:IPageSide;
function megazineSetup(mz:IMegaZine, ps:IPageSide):void {
pageside = ps;
mz.addEventListener(MegaZineFlipStateChangeEvent.MEGAZINE_FLIP_STATE_CHANGE, handleFlipStateChange);
if (mz.flipState == Constants.MEGAZINE_FLIP_STATE_READY && pageside.visible) {
play();
}
}
function handleFlipStateChange(e:MegaZineFlipStateChangeEvent):void {
if (e.newState == Constants.MEGAZINE_FLIP_STATE_READY && pageside.visible) {
play();
} else {
stop();
}
}