Skip to main content
Participant
April 22, 2020
Question

Enable logs for Embedded SWF file in AIR Application

  • April 22, 2020
  • 0 replies
  • 178 views

AIR Application has simple HTML file which embeds a SWF file in it using <object>.

When debugging AIR application using ADL command, only logs related to HTML are getting printed not from SWF.

 

SWFLogs.as

package { 
    import flash.display.Sprite;
    import flash.text.TextField;
    public class SWFLogs extends Sprite 
    { 
        public function SWFLogs() 
        {
            super();
            trace("Log from SWF app");
            var textField:TextField = new TextField();
            textField.text = "Hello, World!";
            addChild(textField);
        } 
    } 
}

Compiling the above SWFLogs.as into SWFLogs.swf

flex_sdk_4.6/bin/amxmlc SWFLogs.as

 

Now embedding SWFLogs.swf into HTML

 

HelloWorld.html

<html lang="en">

<head>
    <title>Hello World</title>
</head>

<body scroll="no">
  <object type="application/x-shockwave-flash" width="100%" height="100%" AllowScriptAccess='always'>
    <param name="movie" value="app:/SWFLogs.swf" />
    <param name="wmode" value="opaque" />
    <param name='AllowScriptAccess' value='always' />
  </object>
</body>

</html>

 

Referring this above HTML in Application descriptor

HelloWorld-app.xml

<application xmlns="http://ns.adobe.com/air/application/2.7">
    <id>examples.html.HelloWorld</id>
    <versionNumber>0.1</versionNumber>
    <filename>SWFLogs.swf</filename>
    <initialWindow> 
        <content>HelloWorld.html</content>
        <visible>true</visible>
        <width>800</width>
        <height>800</height>
    </initialWindow> 
</application>

 

Running in debugging mode using ADL command from AIR

air_sdk/bin/adl HelloWorld-app.xml

 

 

Now how to enable logs from SWFLogs.as to be printed?

Like this log 

trace("Log from SWF app");
    This topic has been closed for replies.