Hi there,
From last few days i’m playing with a AS 3 .0 code which is a bit a headache for me to load swf movies in as 3.0. I created an interactive cd in as 2.0 but now I had to convert in as 3.0 and i can’t load.
here is the code, if somebody can help me. I will be very thankful.
var Xpos:Number = 0;
var Ypos:Number = 0;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("fscommand/index.swf");
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
// Btns fucntions
function info_btn(event:MouseEvent):void {
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("fscommand/information.swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
}
function welcome_btn(event:MouseEvent):void {
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("fscommand/welcome.swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
}
// Btn listeners
welcome_btn.addEventListener(MouseEvent.CLICK, welcome_btn);
info_btn.addEventListener(MouseEvent.CLICK, info_btn);
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Author had a Free File of the Month
- Bought between 1 and 9 items
- Exclusive Author
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
What doesnt work in your code exactly?
Do you get any errors?
I do not think this solves the problem, but some suggestions: before each load not only remove the boot loader screen, and scrub the memory. And then create a new one.
in first var loader:Loader
where you need to make to load:
if (loader != null) { loader.removeListener … // if you added listeners (strange that they are not); removeChild(loader); loader = null;
} after that: loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete); loader.load(new URLREquest…)
on load is function loader_complete(e:Event):void { addChild(loader) }
p.s. If You need – i can to see your sourses and to find error
