Using a transition on an externally loaded swf
Hi, I would have no problem doing this the old fashioned way,
but for some client-requested reason it has to be in AS3. Here's
what I have:
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("movie.swf");
myLoader.load(url);
//Fade-in 9 seconds
TransitionManager.start(myLoader, {type:Fade,
direction:Transition.IN, duration:9, easing:Strong.easeOut});
Apparantly, myLoader isn't the instance name of the loded
swf. I have no idea what it is though. Can someone help me? Thanks!
The loaded swf is at loader.content, but you can only access
it once the loading has completed and the loader has been added to
the display list. For example, CODE 1 will not work, but CODE 2
will.
//CODE 1
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest("movie.swf"));
var loadedSwf:MovieClip = MovieClip(loader.content); //ERROR
//CODE 2
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest("movie.swf"));
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
loadCompleted);
var loadedSwf:MovieClip;
function loadCompleted(ev:Event):void {
loadedSwf = MovieClip(loader.content);
trace(loadedSwf);
PS. I recommend using the Tweener library for tweening in
ActionScript. It is much better than the Adobe functions and there
is a tutorial at:
http://gotoandlearn.com/player.php?id=45
Similar Messages
-
Using the DateField in an Externally loaded SWF
Hello,
I have been having major trouble trying to get a basic PHP
contact form to work within an externally loaded SWF file inside of
a parent SWF. When I test the movie on its own it seems to work
fine (example: I'm able to select a date from the DateField
component). However, when I open up the parent SWF file and call
the external SWF file with the form the DateField is basically
unusable (example: when you click on it nothing happens, no
calendar pops up to select a date).
I have no ActionScript on it yet, simply because I figure I
need it to work before I tell it what to do with the PHP file. The
instance name on the DateField is "theDate". Any help is very much
appreciated. Thank you.
Also, I have just successfully used the contact form on the
web. But, the only user interface components I am able to edit are
the input text boxes, not the DateField or the ComboBox I have in
it as well. This is very odd, I was not aware that anything special
had to be done using these UI components within an external file.
ElijahHello 2m,
Maybe if you were to see it, it may help you out a bit. If
you
click
here for the external file you will see that the components are
working. However, if you
click
here for the parent file and then click on "Meetings" on the
top menu you will see that they do not work at all. However, if
someone were to hit the "send" button, the PHP code would actually
interact with the form. Let me know if that helps at all. Thanks
again for replying.
Elijah -
How can I make my external loaded .SWF file smoothly disappear after 15 seconds?
Hi,
How can I make my external loaded .SWF file smoothly disappear after 15 seconds? The following is the code to load an external .SWF file:
var K:Loader=new Loader();
addChild(K);
K.load(new URLRequest("clock.swf"));
K.x = 165;
K.y = 247;
K.contentLoaderInfo.addEventListener(Event.INIT, growLoader);
function growLoader(evt:Event):void {
K.width = 130;
K.height = 130;
I want to make clock.swf file disappear from the page after 15 seconds using some smooth disappear effect.
Please help.
Thanks.Something even better:
http://www.greensock.com/
Check out TimelineMax I LOVE it...
The guy that made this (and gives it away for free!) is a saint. -
Dynamic Text in Externally Loaded swf
hi. i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.
this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).
here is the sample code:
var loader:Loader = new Loader();
loader.load(new URLRequest("loader.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void{
addChild(loader);
var loader_mc:MovieClip = (loader.content as MovieClip)
loader_mc.myMovieClip.gotoAndStop(2);//***this works
loader_mc.myButton_btn.addEventListener(MouseEvent.CLICK, clickMe);//***this works
loader_mc.myText_txt.text = "12";//***this doesn't work******
please help. thanks!Did you embed the font in the textfield--it needs to be done in the loaded swf when you create it? One other thing to check is that the color for the textfield is not the same as the background it sits on.
-
Passing events from externally-loaded SWFs
Hi,
We have an externally-loaded swf that acts as a kind-of-a slide show. After a user selects a particular subject from a mxml-based "menu" application, they push "buttons" in the SWF to go through a presentation, then on the last frame of the swf, I'd like to unload the swf and replace it with another "mxml" application. How can this be done? I have not tried to pass/capture events "up" from an externally-loaded swf before.
Thanks,
DougDo you own those SWFs? If so, they should dispatch an event from a known
place like a SlideShowManager or something like that.
Other folks "cheat" and bubble events or dispatch off of the systemManager
and/or top-level application. -
How to unload externally loaded swf which contains 3D Carousel?
Hello to all
I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at carousel_c_fla::MainTimeline/moveCarousel()
this error repeats over and over again slowing my swf movie.
So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
//Import TweenMax
import com.greensock.*;
//The path to the XML file (use your own here)
// old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
var xmlPath:String = "carousel-menu.xml";
//We'll store the loaded XML to this variable
var xml:XML;
//Create a loader and load the XML. Call the function "xmlLoaded" when done.
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {
//Make sure that we are not working with a null variable
if ((e.target as URLLoader) != null ) {
//Create a new XML object with the loaded XML data
xml = new XML(loader.data);
//Call the function that creates the menu
createMenu();
//We need to know how many items we have on the stage
var numberOfItems:uint = 0;
//This array will contain all the menu items
var menuItems:Array = new Array();
//Set the focal length
var focalLength:Number = 350;
//Set the vanishing point
var vanishingPointX:Number = stage.stageWidth / 2;
var vanishingPointY:Number = stage.stageHeight / 2;
//We calculate the angleSpeed in the ENTER_FRAME listener
var angleSpeed:Number = 0;
//Radius of the circle
var radius:Number = 128;
//This function creates the menu
function createMenu():void {
//Get the number of menu items we will have
numberOfItems = xml.items.item.length();
//Calculate the angle difference between the menu items (in radians)
var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
//We use a counter so we know how many menu items have been created
var count:uint = 0;
//Loop through all the <button></button> nodes in the XML
for each (var item:XML in xml.items.item) {
//Create a new menu item
var menuItem:MenuItem = new MenuItem();
//Calculate the starting angle for the menu item
var startingAngle:Number = angleDifference * count;
//Set a "currentAngle" attribute for the menu item
menuItem.currentAngle = startingAngle;
//Position the menu item
menuItem.xpos3D = 0;
menuItem.ypos3D = radius * Math.sin(startingAngle);
menuItem.zpos3D = radius * Math.cos(startingAngle);
//Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the menu item according to the scale ratio
menuItem.scaleX = menuItem.scaleY = scaleRatio;
//Position the menu item to the stage (from 3D to 2D coordinates)
menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
//Add a text to the menu item
menuItem.menuText.text = item.label;
//Add a "linkTo" variable for the URL
menuItem.linkTo = item.linkTo;
//We don't want the text field to catch mouse events
menuItem.mouseChildren = false;
//Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
//Add the menu item to the menu items array
menuItems.push(menuItem);
//Add the menu item to the stage
addChild(menuItem);
//Assign an initial alpha
menuItem.alpha = 0.3;
//Add some blur to the item
TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
//Update the count
count++;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveCarousel);
//This function is called in each frame
function moveCarousel(e:Event):void {
//Calculate the angle speed according to mouseY position
angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
//Loop through the menu items
for (var i:uint = 0; i < menuItems.length; i++) {
//Store the menu item to a local variable
var menuItem:MenuItem = menuItems[i] as MenuItem;
//Update the current angle of the item
menuItem.currentAngle += angleSpeed;
//Calculate a scale ratio
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the item according to the scale ratio
menuItem.scaleX=menuItem.scaleY=scaleRatio;
//Set new 3D coordinates
menuItem.xpos3D=0;
menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
//Update the item's coordinates.
menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
//Call the function that sorts the items so they overlap each other correctly
sortZ();
//This function sorts the items so they overlap each other correctly
function sortZ():void {
//Sort the array so that the item which has the highest
//z position (= furthest away) is first in the array
menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
//Set new child indexes for the item
for (var i:uint = 0; i < menuItems.length; i++) {
setChildIndex(menuItems[i], i);
//This function is called when a mouse is over an item
function mouseOverItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
//This function is called when a mouse is out of an item
function mouseOutItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
//This function is called when an item is clicked
function itemClicked(e:Event):void {
//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
navigateToURL(urlRequest);Hi Ned thanks for the reply,
Ok so I have a button in my main movie that loads the external swf
stop();
var my_loader:Loader = new Loader();
var my_btn:Button = new Button();
var my_pb:ProgressBar = new ProgressBar();
my_pb.source = my_loader.contentLoaderInfo;
my_btn.addEventListener(MouseEvent.CLICK,startLoading);
function startLoading(e:MouseEvent):void{
my_loader.load(new URLRequest("carousel.swf"));
addChild(my_pb);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
function finishloading(e:Event):void{
addChild(my_loader);
my_loader.addEventListener("killMe",
killLoadedClip);
removeChild(my_pb);
function killLoadedClip(e:Event):void {
my_loader.removeEventListener("killMe",
killLoadedClip);
my_loader.unloadAndStop();
removeChild(my_loader);
Then I have a button in my loaded swf that closes the loader
This is spread over 2 frames
Frame1
function closeIt(e:MouseEvent):void {
parent.dispatchEvent(newEvent("killMe"));
Frame 2
back_btn.addEventListener(MouseEvent.CLICK, closeIt);
Frame 2 also holds all the code for the carousel
Thanks for your time and help in advance people ; ) -
Setting External Loaded SWF dimension
hi guys...,
i'll be straight to point,well i'm now working on a project using action script 3 now what i'm trying to make is a Main SWF that load whatever other swf into it the tricky thing is that i used 1 xml document read the external swf source and it's setting(such as it's x,y position and it's width and height) and i'm having problem setting the loaded swf width and height btw it's an desktop application and not a website application.,
here is my code:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.INIT, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
and here is what the result ( it make the width and height of the loaded swf to 0):
swfLoader.contentLoaderInfo.width : 320
swfLoader.contentLoaderInfo.height : 240
module: MyVideo/flvplayer.swf
x:0
x container:0
y:0
y container:0
xml width:550
width container:0
xml height:400
height container:0
myCounter: 1
swfLoader.contentLoaderInfo.width : 550
swfLoader.contentLoaderInfo.height : 400
module: AnalogueClock.swf
x:50
x container:50
y:0
y container:0
xml width:250
width container:250
xml height:200
height container:200
myCounter: 2
swfLoader.contentLoaderInfo.width : 800
swfLoader.contentLoaderInfo.height : 30
module: MyNewsticker/newsticker.swf
x:0
x container:0
y:0
y container:0
xml width:300
width container:0
xml height:50
height container:0
most of my loaded swf beside the analouge clock is full action script code and in case of the analouge clock it is a swf that has a movie clip on it's stage (the other are fully created from action script 3.0)
please do help me..,
cause i'm already really desperate and going crazy by this problem..,sorry i copied the code from the other swf i used to do try and error test..,
basically the container is the same as swf varibale
here the code so you would'nt get confused:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
well in my code i did cast the loader into a movie clip and then set it's width and heigt,right???
wouldn't it just give me the same result??
if it's not can u describe what u mean in more detail??
some example about accessing the loader content would be really appreciated -
Color external loaded swf in AS3 Help Urgent!
Hi i have loaded swf from an external path using the following command.
var cviewer:Loader=new Loader();
var curlRequest:URLRequest=new URLRequest("clipArts/"+evt.target.name);
So this is the scenario.
Suppose say i load Movie1.swf
I have three movie clips inside Movie1.swf called step0, step1, step2
I need to change the color of step0, step1 and step 2 from the parent flash file which loads movie1. All the inner movie clips color may be different from each other.
I am able to change the color of the whole movie clip by using
var colorInfo:ColorTransform = cviewer.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
cviewer.transform.colorTransform=colorInfo;
But not of individual ones. I even tried cviewer.step0.transform.colortransform and other stuff to see if it would work. But nothing worked. Help at fastest would be deeply appreciated.
Regards and thanks in advance.try:
var colorInfo:ColorTransform = MovieClip(cviewer.content).step0.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
MovieClip(cviewer.content).step0.transform.colorTransform=colorInfo; -
Map and externally loaded swf working together
Here's the setup:
I have a panoramic viewer, and i'd like to have a map go
along side it. The panoramas are loaded externally into the player.
Inside these external swf files are "hotspots" that link to other
panoramic swf files that load and take the previous swf's place. I
have all of this set up, and you can see how I did it in my
previous post:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1274410&enterthread=y
So now my new question is... how can I have a map with points
on it, that when you click on a point, it will load a corresponding
swf file into the player. I believe that part is easy. My big
problem is if someone clicks on a hotspot in the external swf file
first, which in turn loads another swf file, and if that person
goes back to the map, I want the map to change the position of lets
say, a marker or a pin to indicate the new position on the map that
correllates to the new external swf that was loaded.
make sense? Any ideas? I was thinking maybe it would be some
kind of listener or something so that should a specific swf load,
it will recognize it and automatically change the location of the
marker on the map to the point that relates to the loaded swf or
something...Hi Thanks for your reply, I tried with a small AS3 file as
well and I get the same ERROR. -
"Detecting" a variable from an externally-loaded SWF via SWFLoader
I load an external SWF file from a click event. Then, when the interactions has reached the end of the presentation, we'd like it to unload itself, and go into another state.
Is that possible? ( actually transformed the SWF into a component using Flash Builder 4 hoping that would be easier to detect variables and events)
Thanks,
DougIt is possible, but you'll have to wire up the communications between the
SWFs -
Trying to get a movieclip to display on top of an externally loaded swf
I am trying to ensure that a movieclip named "Incorrect"
displays on top of a swf file that loads with the following:
loadMovieNum("map.swf",1);
I'm sure it's pretty simple, but I couldn't find any good
reference to a movieclip loading on top of an external swf. I tried
loading the map.swf into a placeholder movieclip and doing a
swapDepth, but then the code within the map.swf would no longer
function properly.
thanks.you must load that movieclip into a _level greater than 1.
there is no work-around if you load map.swf into _level1.
you could load map.swf into a target movieclip and then use
the swapDepths() method of movieclips to control the apparent depth
of map.swf and your movieclip. -
GetDefinitionByName not finding class in externally loaded SWF
In my app, I have an external SWF that contains a bunch of
movie clips that I want to instantiate in my main swf.
I have checked the "Export for ActionScript" and the "Export
in first frame" box in the movie clip in Flash.
In my main SWF, I have action script code that loads the SWF
(using the normal Loader and URLRequest classes).
When the load completes, I do:
var loader:Loader = Loader(event.target.loader);
var movieClip:MovieClip = MovieClip(loader.content);
var theClass:Class;
try
theClass = Class(getDefinitionByName("TestClass"));
catch(e:Error)
trace("TestClass not found!");
return;
I have never gotten it to successfully find the class.
Is there anything else I might be doing wrong?
ThanksAh, I figured it out. I need to use the applicationDomain. So
instead of using getDefinitionByName, I would call:
event.target.applicationDomain.getDefinition("TestClass");
That seems to work....
Thanks -
Air 1.0, Externally Loaded SWF Accessing Camera
Hello.
I am building a touch screen kiosk Air App using Flash CS3 and Air 1.0.
I have my application downloading external SWFs for different advertisements, one of which will need access to the webcam built into the kiosk.
By itself, the advertisement accesses the camera just fine, however Camera.getCamera() returns null when it the SWF loaded into the kiosk app. Both the main kiosk app and the advertisement app are compiled using Air 1.0.
It appears that I'm getting a security sandbox violation, however I'd like to avoid completely rewriting my app using the sandbox bridge architecture just so one of my ad pieces can access a webcam.
Does anyone have any suggestions or know of any work-arounds for allowing webcam accesss from within an embedded SWF in Air?
Would upgrading to CS5 / Air 2.5 help?
Thanks for any resposes.
-John BermanI was able to find a workaround of the security sandbox using Loader.loadBytes();
Aleksandar Andreev's Loader class really helped:
http://blog.aleksandarandreev.com/?p=42 -
Controlling the sound of the external loaded SWF
I have a Loader that loads external SWF. The external SWF has sound.
I'd like to stop, pause and play the sound.
How?
Please help me !
var loader:Loader = new Loader();
loader.load(new URLRequest("moora.swf"));
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_loader_complete);
var mc:MovieClip;
var st1:SoundTransform = new SoundTransform();
var sn:Sound = new Sound();
var ch:SoundChannel;
var offset:Number = 0;
function on_loader_complete(e:Event):void
mc = MovieClip(loader.content);
play_btn.addEventListener(MouseEvent.CLICK, on_play_btn);
pause_btn.addEventListener(MouseEvent.CLICK, on_pause_btn);
stop_btn.addEventListener(MouseEvent.CLICK, on_stop_btn);
trace(mc.totalFrames);
function on_play_btn(e:MouseEvent):void
mc.play();
st1.volume = 1;
mc.soundTransform = st1;
function on_pause_btn(e:MouseEvent):void
mc.stop();
st1.volume = 0;
mc.soundTransform = st1;
function on_stop_btn(e:MouseEvent):void
mc.gotoAndPlay(1);
mc.soundTransform = st1;
This only mute the sound only and the sound is still runnung.The loaded external SWFs are AS3. The sound is on the timeline. Some SWFs use loaded sound, Here is its code:
var snd:Sound = new Sound();
var req:URLRequest = new URLRequest("moora.mp3");
snd.load(req);
So, how can I control the sound (Stop, Pause, resume). -
Externally loaded swf in second window doesn't display properly?
I have a bitmap based flash game (bitmapdata generated screen) that I'm trying to load in to a secondary nativewindow generated from a main flash (not AJAX/HTML) based AIR app that's a graphical menu. I.E. you click on a selection in the menu, and it pops open a secondary nativewindow with the flash game running in it. The problem is, the game itself gets mangled in the secondary window when it loads in. Keyboard input goes away, the bitmap doesn't draw properly (it streaks like its not drawing the background image each frame), most of the game objects its supposed to draw in to the bitmap are missing, etc.
When I make the game itself in to its own AIR app and run it direct, it works just fine. So I'm puzzled. Is there some kind of special coding considerations in the as3 side that I'm missing with the original game? I.E. if a flash based AIR app launches another nativewindow and loads a swf in to that, does it share some kind of variable set, display list, etc. with the calling window? Something else? Any help would be appreciated.There are a few differences between (A.) letting the AIR runtime load content into the initial window and (B.) loading content into a new NativeWindow.
1. In case A, the stage property is available in the class constructor for the main sprite. In case B, this is not the case. You may have to use an ADDED_TO_STAGE event handler to do some class initialization.
2. In case A, the initial scale is based on the metadata present in the SWF -- this results in the behavior you would expect. In case B, there is no SWF to base the scale on when the window is created, so a default scale is used -- this is rarely results in behavior you would expect (unless the window happens to be created with a size of 72x72 pixels).
If you aren't setting the stage to noScale, then this could account for some of the visual issues. (See http://www.adobe.com/devnet/air/flex/quickstart/launching_windows.html for an explanation of the scaling issues.) The easiest thing to do is to set the Stage scaleMode to noScale and the align property to the top left setting. I'm guessing your drawing code isn't expecting the scaling so things are getting put in the wrong place.
3. In case A, the content is automatically put in the application sandbox. In case B, it depends on the URL.
As for the Keyboard input, this may depend on how you are loading the SWF and from where. This could be related to #3 above, although I would expect to see security errors. How are you adding your keyboard event handlers?
Maybe you are looking for
-
SHARED MEMORY AND DATABASE MEMORY giving problem.
Hello Friends, I am facing problem with EXPORT MEMORY and IMPORT MEMORY. I have developed one program which will EXPORT the internal table and some variables to the memory.This program will call another program via background job. IMPORT memory used
-
IS-U enhancing transaction FPBW (open items extraction using table DFKKOPBW
Has anybody experiances with IS-U Accounts Receivable & payable - 'Open Items' extraction using transaction FPBW (which fill the table DFKKOPBW). 1. I need to fill an custom included structure in this table (DFKKOPBW) and I am searching for the corre
-
How to know jspx is open inside a Dialog window
Hi, How to know the jspx is opened inside a ADF Dialog window from the custom javax.faces.event.PhaseListener. thanks, Lahiru.
-
Hi, I am using an inbound Purchase Invoices INVOICE02. Is it possible to park an invoice via idoc rather than creating it in MIR0. I do not want my IDOC to post the invoice and rather need to just park the invoice. Regards Krish
-
Connect MBAir to internet via dial-up (PPP)
I recently purchased a new Macbook Air running OS X Mountain Lion. At home, my Internet access is via an external 56K USB modem connected to an older iMac. I've tried using the same modem to connect the MBAir to the Internet with no success. Any ide