Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to load External swf file in AIR

Explorer ,
Jan 17, 2013 Jan 17, 2013

I try this code its working in computer but when I publish this file in .apk or .ipa , my external swf file is not opening

(I include my external file as well)

places_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

     trace("you clicked me");

     var loadit = new Loader();

     addChild(loadit);

     loadit.load(new URLRequest("scene02.swf"));

}

01.jpg

TOPICS
ActionScript
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jan 21, 2013 Jan 21, 2013

add this in your newid function:

You forgot to put the beginning of your original function in it:

     var loadit = new Loader();

     addChild(loadit);

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

    loadit.load(new URLRequest("scene02.swf"), _lc);

Translate
Guru ,
Jan 17, 2013 Jan 17, 2013

add this in your newid function:

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

loadit.load(new URLRequest("scene02.swf"), _lc);

details about why you should provide a loader context here

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 18, 2013 Jan 18, 2013

If you try to load AIR App from CD - in some cases Air can't find file using Loader. Use File class instead and only than using Loader use loadBytes. I made presentation that works prefectly locally. But when I put it on CD - it's can't find any SWF so only one solution was it's use File class.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 19, 2013 Jan 19, 2013

then what well be the code??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 19, 2013 Jan 19, 2013

places_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

trace("you clicked me");

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

loadit.load(new URLRequest("scene02.swf"), _lc);

}

i try this but got this error

"access of undefined property loadit"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 21, 2013 Jan 21, 2013

add this in your newid function:

You forgot to put the beginning of your original function in it:

     var loadit = new Loader();

     addChild(loadit);

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

    loadit.load(new URLRequest("scene02.swf"), _lc);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2013 Jun 29, 2013

thx boss its working great

I have 3 scenes; load scene code is working great

1. How can I unload the scene?

2. Can I unload all scenes or one by one?

can I unload some think like this

Load scene 2 , unload scene 1 and scene 3

Load scene 3, unload other all scene

------------------------------------------------------------------------------

i try this

--------------------------------------------------------------------------------------------------

load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

          trace("you clicked me");

          var loadit = new Loader();

          addChild(loadit);

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

    loadit.load(new URLRequest("scene02.swf"), _lc);

          loadit.unload();

}

---------------------------------------------------------------------------------------------------------------------

load3.addEventListener(MouseEvent.MOUSE_DOWN, newvid1);

function newvid1(event:MouseEvent) {

          trace("you clicked me");

          var loadit = new Loader();

          addChild(loadit);

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

    loadit.load(new URLRequest("scene03.swf"), _lc);

          loadit.unload("scene01.swf scene02.swf");

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 30, 2013 Jun 30, 2013

According to the documentation there is a problem with unload/unloadAndStop below AIR 3.6 on ios:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html#unloadA...

Amke sure you update accordingly

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2013 Jul 01, 2013
LATEST

now i try this but still facing the problem

http://forums.adobe.com/message/5463931#5463931

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