Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to load SWF from application storage directory
    primarykey
    data
    text
    <p>While publishing my AIR application(CurrentFile), I have also included chatFile.swf with the installation files. In my AIR settings panel [AIR 3.7 for Desktop], under 'Include Files' I have the following:</p> <blockquote> <ul> <li>CurrentFile.swf</li> <li>CurrentFile-app.xml</li> <li>chatFile.swf</li> </ul> </blockquote> <p>Here is the AS3 code in my CurrentFile.swf:</p> <pre><code>import flash.net.URLRequest; import flash.events.Event; import flash.display.Loader; import flash.filesystem.File; var chatLoaderWindow:Loader; function loadchat(m:MouseEvent):void { chatLoaderWindow = new Loader(); chatLoaderWindow.contentLoaderInfo.addEventListener(Event.COMPLETE, chatLoadComplete); chatLoaderWindow.contentLoaderInfo.addEventListener(Event.INIT, chatInitLoad); chatLoaderWindow.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, chatErrorLoad); chatLoaderWindow.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, chatHttpStatus); myclip.chatwindow.addChild(chatLoaderWindow); var f:File = File.applicationStorageDirectory.resolvePath("chatFile.swf"); chatLoaderWindow.load(new URLRequest(f.url)); tracebox.text = "Chat URL" + f.url; } function chatLoadComplete(e:Event):void { tracebox.text = "chat loaded"; } function chatErrorLoad(io:IOErrorEvent):void { tracebox.text = "chat IO Error: "+io; } function chatInitLoad(i:Event):void { tracebox.text = "chat INIT"; } function chatHttpStatus(e:HTTPStatusEvent):void { tracebox.text = "chat Http"+e; } myclip.chatbut.addEventListener(MouseEvent.CLICK,loadchat); /* Output: chat IO Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2035" errorID=2035] </code></pre> <p>EDIT: I figured it out. It was really simple</p> <p>This is not required:</p> <pre><code>var f:File = File.applicationStorageDirectory.resolvePath("chatFile.swf"); chatLoaderWindow.load(new URLRequest(f.url)); </code></pre> <p>Insert this: </p> <pre><code>chatLoaderWindow.load(new URLRequest("app:/chatFile.swf")); </code></pre> <p>So now my question is: What is the purpose of File.applicationStorageDirectory.resolvePath?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload