Hi...
I'm having a bit of trouble with the code in the xml.
I've made an interface consisting of floorplans in a building that I want to turn on and off depending on which floor you're at.
All works fine when I just set the visibility but I really want to do a simple crossfade between two layers.
I've made an action called 'switchlevel' which in turn calls an action called 'showlevel' twice, once to hide the current floorplan and once to show the new floorplan.
For the fade I use the tween function but somehow the second time I call 'showlevel' the first tween is simply overridden.
Here is a simplified version of the action:
Code
<!-- show or hide level
%1:Object level
%2:Boolean show or hide
%3:Boolean no alpha animation
-->
<action name="showLevel">
<!-- level visibility -->
set(sLayer,get(level[%1].val));
set(bShow,get(%2));
trace('showLevel ',%1,' ',%2,' ',%3,' p: ',level[%1].point.count);
if(%3==true,<!-- damn you stupid crossfade -->
set(plugin[get(sLayer)].alpha,1);
set(plugin[get(sLayer)].visible,get(bShow));
,
set(fAlpha,0);
if(bShow==true,
set(fAlpha,1);
set(plugin[get(sLayer)].alpha,0);
set(plugin[get(sLayer)].visible,true);
);
tween(plugin[get(sLayer)].alpha, get(fAlpha), 0.25, linear,
if (bShow==false,
set(plugin[get(sLayer)].visible, false);
);
set(plugin[get(sLayer)].alpha,1);
trace('tweendone ',sLayer,' ',bShow); <!-- this is only traced once, even if the action is called twice -->
);
);
</action>
Display More
Hope anyone can figure this out, caus I'm stumped