PDA

View Full Version : Detect onTransitionEnd


SvenA
11-13-2008, 07:28 PM
I working on a project build in flash with a lot of enbedded flashpanoramas. I is a touchscreen system and the user i switch pano from buttons in the mother flash file. It is working fine. The transition plugin works nicely too.
However, I have some reasons to fire a function in my mother flashfile when the transition between two panoramas are finished..
But I cant figure out how to detect when ”onTransitionEnd” fires in my XML file.
I have have set up a function in my xml file like this

<?xml version = '1.0'?>
<panorama>
<parameters>
layer_5 = files/hotspots.swf
</parameters>
<hotspots>
<global onTransitionEnd="finishedForReal =true">
</global>
</hotspots>
</panorama>

In the trace window it is possible to see this:
Execute global: finishedForReal =true
Custom field: finishedforreal
This seems to fire after the transition have finished.

But how do I read in this in my code?
Do anybody have a hint?

//SvenA

agnosix
11-18-2008, 11:34 AM
I solved this problem checking for panorama.externals.hotspots.panoName it changes when the new pano is loaded and the transition is end.

something like that:


var panoBusy:Boolean = false;
var panoAct:String="your_firts_pano_name"
var panoLoa:String;
panorama.addEventListener(Event.ENTER_FRAME, panoBusyTest);
function panoBusyTest(e:Event) {
if (panoBusy) {
panoAct = panorama.externals.hotspots.panoName;
if (panoAct == panoLoa) {
trace("TRANSITION END");
panoBusy = false;
}
}
}

When you load a new pano set panoLoa="the_name _pano_load".

Hope this helps.

SvenA
11-19-2008, 01:24 PM
Thanks a lot.

Maybe this is the way to do it. I worked with some modification. I dont understand the usage understand panoBusy though. I tried to trace it but it was false the whole transition cycle. Anyway I think I can kill the listener i some other way.


var panoBusy:Boolean = false;
var panoAct:String="your_firts_pano_name"
var panoLoa:String;
this.addEventListener(Event.ENTER_FRAME, panoBusyTest);
function panoBusyTest(e:Event) {
//if (panoBusy) {
panoAct = panorama.externals.hotspots.panoName;
if (panoAct == panoLoa) {
trace("TRANSITION END");
panoBusy = false;
}
//}
}