ActionScript 3.0 :: Parameter Passing Between Two SWFs?
Jan 27, 2009
The problem I am currently having right now is the inability to send variables loaded from the LoaderSWF to the SWF that has been loaded.
Concretely speaking, I have an embed script on an HTML page that contains several variables in the FlashVars line. The embed script loads a file called loader.swf. Loader.swf's main responsibility is basically take those variables from the flashvar, load the game URL and pass along the rest of the necessary parameters to the game that the loader is loading. However, I've been working out several solutions and none of them worked the way I wanted to.
how can I load the game SWF file and send along additional parameters with that request? Is there someway I can punch in variables into the myLoader object?
The code I came up with sends along the authenticity token just fine, however, it is not sending score_url correctly. I'm not sure if that is the correct behavior, but please enlighten me with any insights you may have.
I have also considered trying LocalConnection, but the problem is that I do not have the necessary source code for the games to set up LocalConnection on the receiving end.
Also, the game files are using AS2, while the loader is using AS3. The game files read variables by utilizing _root.score_url, etc.
I have a function setup that I was hoping to re-use to eliminate a bunch of code, but I can't figure out how to pass a parameter to it. I'm getting the trace output, but the rest of the function is not working.Is there a way to get this to work?From what I can tell the syntax matches the examples in the reference guide.
i have 1 PHP page in which i have a Flash animation. this flash swf file, display 2 fields and 1 button.
this php page is called "test.php".
i'm able to send data from Flash to a PHP page, but i would like to send the content of those 2 fields to the "test.php" and display them. however, i do not know how to do it.
i see that it works but i'm not able to display or refresh the PHp page to display the result.
as walkaround i was thinking to collect the webpage address where is executed the flash and to send it to another PHP page. and this 2nd PHP page, will reload the test.php with parameters...
how to get under flash, the address of the actual executed php page ?
I would like to know if is possible to pass a var type as parameter to a function. I have several sounds in library, and I would like to do something like that:
Code: function PlayMe(soundname:String) { var snd:this[soundname] = new this[soundname]; snd.play(); }
I am new to flex and SAP. I am designing a dashboard in flex. I have retrieved data from SAP query_view_data and I am able to show it in charts. However now I want to pass parameter to SAP web service to retrieve data between two dates. I am trying to this with the following code:
protected function adg1_creationCompleteHandler(event:FlexEvent):void { var IInfoprovider:String="0FIGL_O02";
I have a function that I want to use to change either the _x and _y or the _width and _height. Rather than writing a separate function for each.For example, instead of writing this...
My problem is, when I call the function as I wrote it above, Flash naturally takes the _width and _height Values (ie. 432, or whatever the width and height may be), instead of literally putting '_width' or '_height' where the params are found throughout the function...
I have a flash movie for drop down menus that is called by all flash/movie banner sections of my site. The banner movies use FlashVars to set the heading and an image. The trouble is that the flash menus also were set to use a flashvar to dictate the context of the menus and leave one top level menu highlighted to show the content to the user. I have not been able to get both of them to use the Flashvars functionality. The html page calls the banner movie directly and it can therefore access the Flashvars. The menu swf however - which is not called from the html page but instead is called from within the banner movie - cannot access the flashvars variables. That leaves me with two choices:
1. Either use a different method for passing the context variable to the menu movie. 2. HTML code calls the banner movie. I can continue using flashvars and get the context variable by reading it from within the banner movie - and then somehow pass the value down to the menu movie if that is possible.
I have an asp.net page where I get the user_id from who's logged in. Now I need to pass this user_id to a flex application that runs in an asp.net page as a .swf. How can I get this user_id in a variable in my flex application.Or what is the best way to get the user_id into flex.
i have 1 PHP page in which i have a Flash animation. this flash swf file, display 2 fields and 1 button.
this php page is called "test.php".
i'm able to send data from Flash to a PHP page, but i would like to send the content of those 2 fields to the "test.php" and display them. however, i do not know how to do it.
i see that it works but i'm not able to display or refresh the PHp page to display the result.
as walkaround i was thinking to collect the webpage address where is executed the flash and to send it to another PHP page. and this 2nd PHP page, will reload the test.php with parameters...
but once again, how to get under flash, the address of the actual executed php page ?
I am connecting to a web service that I know has a method named getAddy.However, in order to work properly I need to provide this method with a paramater named sessionToken. I'm having difficulty with this, my code currently looks like this:
ActionScript Code: var WS_URL:String = "http://somedomain?wsdl"; var addy_ws:WebService = new WebService(this.WS_URL);
I am trying to build a static function that will allow me to do any sort of effect I want, however I would like to give it pass certain parameters but I am not quite sure how to do it. I am basically trying to write my own effects package with easing and all sorts of thing. ActionScript Code: public static function easeMC(targetMC:MovieClip, mcProperty, amount:Number, speed:Number){ targetMC.mcProperty = do the easing code; }
Basically, those are the parameters im trying to pass but I don't know how I would go about assigning the property per se, like if I want the x position or the width to be the one animated. The easiest way I can think of is making mcProperty a string and then doing this: ActionScript Code: switch (mcProperty) case "width": targetMC.width = do the easing code; case "x": targetMC.x = do the easing code;
for(var i=1;i<=2;i++) { var mc=attachMovie("mc_name","obj"+i,i) mc._x=200*i;
[code]....
this code places two objects obj1 and obj2 and two buttons button1 and button2
button1 is expected to return _level0.obj1 button2 is expected to return _level0.obj2
Instead they both return _level0.obj2. Obviously, each button is passed the object corresponding to the last "i" in the loop. How shall I sort this out? One of the obvious solution sis to attach each button to its object
mc.mc=mc.attachMovie("button","button"+i,i+10);
but this is not acceptable for some other reason I also have to use this for(var i=1;i<=2;i++) block because in the final application the number of objects will be variable and set by the user at the run time.
Following my tiny project I experienced awkawrd behaviour of the sound object. Likely it is something wrong in my code though. I've got a DocumentClass where the sound loads in, and then starts, and have 2 Sliders, one responsible for actual position of the sound in time, and second VolumeSlider. I pass to both of them current Sound object and SoundChannel to the constructor and when I move my TimeSlider to scrub the sound I hear that second sound plays in the background (which is not scubbable). Moreover my VolumeSlider even if it passes a value to the sound.soundTransform and reapply it I didn't hear any change. My question is: can I have right soundChannel object referenced in other classes to change its parameters? From my point of view it is rhetorical question and any passed object has a reference to the main object, but as always I can be wrong.
Or maybe some of had similar issue in the past. Particularly I can instantiate my sliders in the same class as sound object to pass the value(already sliders are instantiated in mainPanel class which represents what the name suggest - main panel ^^just exactly like i.e. Winamp^^ )this way it should work ( I wouldn't have to pass sound object as a parameter to the sliders objects but retrieve slider's value to change the volume) From one point it is clear method as sliderVolume object shouldn't have an sound object inside, but from the point of my app it would be better to pass it though and manage inside the sliderVolume, timeSlider sliders.
I am using the asfunction to call a function and passing a parameter. The problem is in the parameter. I can give a parameter that is over 104 characters. What ever is after that 104th character doesnt pass into the string of the function.
I'm having troubles activating the HitTest, passing the objects name as a parameter through a global function. Let's say there is the following function on the main timeline:
Code: _global.fallIntoBasket = function (fallingObject) { if (_root[fallingObject].hitTest(_x, _root.basket_mc._y+(_root.basket_mc._height/2)-7, true)) { trace ("teste"); _root[fallingObject]._alpha=0; }}
I then call this function passing the this._name of the object as a parameter in a onClipEvent (EnterFrame) on each of the falling Objects action box. The whole detection thing doesn't work though... but if I place the hitTest code on each of the object, and change the _root[fallingObject] to this it works. Can I not pass hitTest through a function?
how to pass a constant into a function, and then for that function to make use of that constant in its constant form (not the string form).
Some code snippets:
Code: // make call to play ad, passing a constant value defined in a separate AdType class // in the AdType class, AdType.PREROLL = "before_content"
[Code].....
I realize this is because the value of AdType.PREROLL resolves to a String value ("before_content"), which is then getting passed into the function as such (a String), but is there a way I can make use of that same constant in the playAd function without having to check its string value directly?
I've been writing movies in AS2 that have variables passed to them via the src parameter of the page code, e.g. src="/Flash/theMovie.swf?value=1"
Then in the AS I don't need to define 'val', I can use it straight away. However, in AS3 - at least, as I understand it - it seems that I can't drop 'val' into the code without defining it, as it throws ""1120: Access of undefined property val".
So, if I add a line of code public var val:Number; or somesuch, will this be enough to ensure 'val' is useable once it comes through from the page?
I am using the asfunction to call a function and passing a parameter. The problem is in the parameter. I can give a parameter that is over 104 characters. What ever is after that 104th character doesnt pass into the string of the function.