Highlighted

Loading an External SWF File with Stage 3D in an AIR Application

Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

Hi,

I have been trying to create an Adobe Air application which can download a SWF file and run it. This SWF file uses Stage 3D rendering.

I am able to load an external SWF file through an object of Loader Class, but only the Display Object elements from the SWF show up in the AIR App (Eg: Text, buttons etc) and not the 3D objects.

To check if there is an issue with the 3D Rendering, i ran scout on the app with Telemetry and Stage3D recording enabled. On Scout, the Stage 3D rendering tab does display the 3D objects. I assume this means the 3D Rendering does work but for some reason the correct stage is not being passed to the containing AIR Application.

I have tried going through posts and have defined right app flags. Eg: renderMode is set to direct, depthAndStencil is set to enabled etc. Morever i do not get any errors related to Stage3D classes.

What is it that i might be doing wrong? And is what i am trying to do even possible?

Correct answer by abdulqadir7 | Community Beginner

I was trying somethings out with various background properties and looks like setting:

backgroundAlpha="0.0" as a WindowedApplication parameter or calling this.setStyle("backgroundAlpha","0.0") in the onApplicationStarted() method removes the white background and lets the 3D rendering to show up.

Marking the issue to answered now

TOPICS
Development

Views

244

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

Loading an External SWF File with Stage 3D in an AIR Application

Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

Hi,

I have been trying to create an Adobe Air application which can download a SWF file and run it. This SWF file uses Stage 3D rendering.

I am able to load an external SWF file through an object of Loader Class, but only the Display Object elements from the SWF show up in the AIR App (Eg: Text, buttons etc) and not the 3D objects.

To check if there is an issue with the 3D Rendering, i ran scout on the app with Telemetry and Stage3D recording enabled. On Scout, the Stage 3D rendering tab does display the 3D objects. I assume this means the 3D Rendering does work but for some reason the correct stage is not being passed to the containing AIR Application.

I have tried going through posts and have defined right app flags. Eg: renderMode is set to direct, depthAndStencil is set to enabled etc. Morever i do not get any errors related to Stage3D classes.

What is it that i might be doing wrong? And is what i am trying to do even possible?

Correct answer by abdulqadir7 | Community Beginner

I was trying somethings out with various background properties and looks like setting:

backgroundAlpha="0.0" as a WindowedApplication parameter or calling this.setStyle("backgroundAlpha","0.0") in the onApplicationStarted() method removes the white background and lets the 3D rendering to show up.

Marking the issue to answered now

TOPICS
Development

Views

245

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
Mar 14, 2018 0
Advocate ,
Mar 14, 2018

Copy link to clipboard

Copied

In your application.xml you might need to set:

<renderMode>direct</renderMode>

and, if you require the feature:

<depthAndStencil>true</depthAndStencil>

Here is the documentation:

Adobe AIR * Common settings

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...
Mar 14, 2018 0
Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

Hi!

Thanks for the response. I have already done that configuration in my application xml.
I get no errors related to Stage3D / Context3D. And on Adobe Scout, the Stage3D rendering tool does pick up the 3D rendering, but the AIR container appears blank.

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...
Mar 14, 2018 0
Advocate ,
Mar 14, 2018

Copy link to clipboard

Copied

Is there a chance that your Air container application renders something on the background? Keep in mind that Stage3D content is always on the lowest level. That means you add the loaded swf as a child of the Air application, but Stage3D content of the child would still render *behind* the Air application. So if it has a background, Stage3D would not be visible. Other than that it should be straight forward. We do the same thing in our air apps as well and Stage3D content renders without problems in the loaded swfs.

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...
Mar 14, 2018 0
Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

I did try out things related to transparency and background, but it wasn't very helpful. I am pasting my code here. Please do check if i am missing out on something.

<?xml version="1.0"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   applicationComplete="onApplicationStarted()">
  <fx:Script><![CDATA[

  import mx.controls.Label;

  protected function onApplicationStarted():void {

  var _urlLoader : URLLoader = new URLLoader;

  var _loader : Loader = new Loader;

  _urlLoader.dataFormat = URLLoaderDataFormat.BINARY;

  _urlLoader.load(new URLRequest("http://wiki.flare3d.com/demos/Test22/flare3d.swf"));

  this.stage.addChild(_loader);

  this.width = 1024;

  this.height = 600;

  _urlLoader.addEventListener(Event.COMPLETE, function(e:Event):void {

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

  lc.allowCodeImport = true;

  _loader.loadBytes(_urlLoader.data, lc);

  });

  var loadingLabel:Label = new Label();

  loadingLabel.setStyle("fontFamily", "consolas");

  loadingLabel.text = "Loading!";

  this.addElement(loadingLabel);

  }

  ]]></fx:Script>
</s:WindowedApplication>

I am trying to load an example Flare3D swf present here: Test22 - Drag & Drop - Flare3D Wiki
The label i added does show up, and once the external SWF gets loaded, the text from that overlaps the Loading text i add. But rest of my container remains blank (white).

I have also added the below configuration and my app.xml

<renderMode>direct</renderMode>
<depthAndStencil>true</depthAndStencil>

Really appreciate your help on this.

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...
Mar 14, 2018 0
Community Beginner ,
Mar 15, 2018

Copy link to clipboard

Copied

I was trying somethings out with various background properties and looks like setting:

backgroundAlpha="0.0" as a WindowedApplication parameter or calling this.setStyle("backgroundAlpha","0.0") in the onApplicationStarted() method removes the white background and lets the 3D rendering to show up.

Marking the issue to answered now

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...
Mar 15, 2018 0