Description of Project:
I am building a prototype of an experimental website design where the pages fly at you as if they were on a zip line of sorts. The problem I am having is the when “page 1” (the page on the first layer) is sent to the back it appears above “page 5” (the page on the last layer). When I try to use setChildIndex to send page 1 to the back, for some reason it makes my page 1 disappear until the next time the timeline starts over.
I have included my code and demos of my project.
Demos:
swf without actionscript: http://dustinnaquin.com/swfs/prototype_no_actions.swf
swf with actionscript: http://dustinnaquin.com/swfs/prototype_actions.swf
import flash.display.DisplayObject;
import flash.events.Event;
var page1:DisplayObject = this.getChildByName("page_1");
var page2:DisplayObject = this.getChildByName("page_2");
var page3:DisplayObject = this.getChildByName("page_3");
var page4:DisplayObject = this.getChildByName("page_4");
var page5:DisplayObject = this.getChildByName("page_5");
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(e:Event):void{
if(e.currentTarget.currentLabel == "swap1") this.setChildIndex(page1, this.numChildren -1);
if(e.currentTarget.currentLabel == "swap2") this.setChildIndex(page2, this.numChildren -1);
if(e.currentTarget.currentLabel == "swap3") this.setChildIndex(page3, this.numChildren -1);
if(e.currentTarget.currentLabel == "swap4") this.setChildIndex(page4, this.numChildren -1);
if(e.currentTarget.currentLabel == "swap5") this.setChildIndex(page5, this.numChildren -1);
}
Any help would be appreciated!!