Highlighted

Reloading swf inside a loader in Air for IOS

Participant ,
Jul 13, 2016

Copy link to clipboard

Copied

Hi friends,

Iam creating an elearning app.  i have 4 buttons on stage, when user clicks it will load 4 different lessons. I have created the following codes, its working fine. when i click same button again it is not loading the lesson. only one time i can click and load a lesson, 2nd time it is not loading.

Kindly help me to solve the issues..

import flash.events.MouseEvent;

import flash.display.Loader;

import flash.net.URLRequest;

import flash.system.LoaderContext;

import flash.system.ApplicationDomain;

var no_les:Number = 4;

var ldr: Loader = new Loader();

var req: URLRequest = new URLRequest();

var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

for (var inc1: Number = 1; inc1 <= no_les; inc1++) {

                this["bt" + inc1].addEventListener(MouseEvent.CLICK, menu_clicked);

}

function menu_clicked(event: MouseEvent) {

                ldr = new Loader();

                req.url = "app:/assets/lessons/les"+event.target.name.substr(2)+"/lmsframe.swf"

                ldr.load(req,lc);

                load_box.addChild(ldr);

}

close_but.addEventListener(MouseEvent.CLICK, close_clicked);

function close_clicked(event:MouseEvent){

                MovieClip(ldr.content).currentMovie.content_mc.gotoAndStop(1);      

                for(var inc2:Number = 0; inc2<=load_box.numChildren-1; inc2++){

                                load_box.removeChildAt(inc2);

                }

                ldr.unload();

}

Thanks in advance,

Regards,

Syed Abdul Rahim

TOPICS
Development

Views

152

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Reloading swf inside a loader in Air for IOS

Participant ,
Jul 13, 2016

Copy link to clipboard

Copied

Hi friends,

Iam creating an elearning app.  i have 4 buttons on stage, when user clicks it will load 4 different lessons. I have created the following codes, its working fine. when i click same button again it is not loading the lesson. only one time i can click and load a lesson, 2nd time it is not loading.

Kindly help me to solve the issues..

import flash.events.MouseEvent;

import flash.display.Loader;

import flash.net.URLRequest;

import flash.system.LoaderContext;

import flash.system.ApplicationDomain;

var no_les:Number = 4;

var ldr: Loader = new Loader();

var req: URLRequest = new URLRequest();

var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

for (var inc1: Number = 1; inc1 <= no_les; inc1++) {

                this["bt" + inc1].addEventListener(MouseEvent.CLICK, menu_clicked);

}

function menu_clicked(event: MouseEvent) {

                ldr = new Loader();

                req.url = "app:/assets/lessons/les"+event.target.name.substr(2)+"/lmsframe.swf"

                ldr.load(req,lc);

                load_box.addChild(ldr);

}

close_but.addEventListener(MouseEvent.CLICK, close_clicked);

function close_clicked(event:MouseEvent){

                MovieClip(ldr.content).currentMovie.content_mc.gotoAndStop(1);      

                for(var inc2:Number = 0; inc2<=load_box.numChildren-1; inc2++){

                                load_box.removeChildAt(inc2);

                }

                ldr.unload();

}

Thanks in advance,

Regards,

Syed Abdul Rahim

TOPICS
Development

Views

153

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 13, 2016 0
Most Valuable Participant ,
Jul 13, 2016

Copy link to clipboard

Copied

If you tell us what Adobe software you are using, we may have your question redirected to the proper forum. This one is for forum related issues, not for help with specific programs.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 13, 2016 0
Participant ,
Jul 13, 2016

Copy link to clipboard

Copied

HI claudio,

Thks for ur reply and help. Iam in using Adobe Air for IOS.

thanks and Regards,

Syed Abdul Rahim

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 13, 2016 0