medxmedia
asked on
Adding external content to new NativeWindow in Adobe Air
Hi,
I'm working on an Air application that I am building using flash professional CS5. I have a new native window and am able to add some content (e.g. a text field) to it, but cannot add loaded files. I have testetd the loader with the default window and its content is added as expected, but using the same method (addChild) with the new native window does not add the loaded content.
I'd appreciate any ideas you may have on how to resolve this.
Best,
C.S.
I'm working on an Air application that I am building using flash professional CS5. I have a new native window and am able to add some content (e.g. a text field) to it, but cannot add loaded files. I have testetd the loader with the default window and its content is added as expected, but using the same method (addChild) with the new native window does not add the loaded content.
I'd appreciate any ideas you may have on how to resolve this.
Best,
C.S.
ASKER
Hi dgofman,
Thanks for your reply. The link you provided references flash builder. In Flash, "addElelment" throws an error.
Thanks for your reply. The link you provided references flash builder. In Flash, "addElelment" throws an error.
Can you attach some sample of your project I would like to run locally on my machine?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, now is clear for me.
Yes you have to use code bellow
newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
newWindow.stage.align = StageAlign.TOP_LEFT;
var bitmap:Bitmap = AppLoader.content as Bitmap;
newWindow.stage.addChild(b itmap);
newWindow.activate();
for AIR application the NativeWindow class represent as popup window and you cannot apply scaling (like Alert dialogs)
I think
Yes you have to use code bellow
newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
newWindow.stage.align = StageAlign.TOP_LEFT;
var bitmap:Bitmap = AppLoader.content as Bitmap;
newWindow.stage.addChild(b
newWindow.activate();
for AIR application the NativeWindow class represent as popup window and you cannot apply scaling (like Alert dialogs)
I think
But you can listening resize event and scale your image
http://www.ben-morris.com/howto-add-flex-mx-controls-to-a-nativewindow-for-adobe-air
http://www.ben-morris.com/howto-add-flex-mx-controls-to-a-nativewindow-for-adobe-air
In the precending code, you've also avoided the deformation of the objects on the stage by setting the scaleMode property to StageScaleMode.NO_SCALE.
ASKER
I stumbled on to my own solution.
http://www.kirupa.com/forum/showthread.php?357679-addElement-vs.-addChild