ActionScript 2.0 :: Passing Variable To Function By Ref?
Feb 23, 2011
If I remember correctly, objects are being passed to functions by reference, so I wrapped my primitive variable into object but did not get the resilt I wanted. I combed this group to see the solution and found only this one:
function changeObjectStatus(obj)
{
return obj.status = true;
}
[Code]....
var v seems to be a new object rather then a reference to the old one. and changing v does not affect the original object.
Does this mean that if I want the function to work with several variables, I need to create a separate object for each variable?
View 2 Replies
Similar Posts:
Sep 16, 2009
I need to pass a variable to a function inside a function. However this parameter (i) seems not to be passed (to function ...onRollOver). This is required to attach a textfield to a movieclip (reading the adress and showing it as a tooltip).
ActionScript Code:
for (i=0; i<array_BE_ElecCities.length; i++) {
var attachElecCity = mc_map.mc_places.attachMovie("Plant",
[code].....
View 1 Replies
Mar 19, 2009
I have 3 movieclips in the Libarary, called (both by name and class) section0, section1 and section2.This works for instance to attach a movie clip to the stage:
Code:
var myMovie:MovieClip = new section1;
addChild(myMovie);
[code].....
View 2 Replies
Feb 21, 2011
Trying to create a random movement for fish MCs:
//----------------------
var deg2rad:Number = Math.PI / 180;
var speed:Number = 1;// set to speed you want
var numFish:Number = 4;
[Code].....
Problem I have is that they all move to the same angle (the last one created).
How do I pass the different "my_angle" values to the "move_me" function...?
View 7 Replies
May 6, 2009
How do I pass mulitple variables from a function using AS3? Does this have to be done using a Class?
example:
var endValue; // variable I want to fill
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, dataLoaded);
[Code].....
View 8 Replies
Jun 8, 2009
This is a function on the first frame of a .fla updated to AS3 from an old AS2 file:[code]When the function is called it should set "max_messages" to 600 in AS3, right?
View 1 Replies
Aug 31, 2007
Been looking everywhere to find out if there is a way to do this:
[Code]...
Anyone know Of a way to accomplish this without having to use an if/then statement
View 4 Replies
Jul 28, 2008
I have this script that reads pictures and links of the pictures from the an xml file, display the picture and then put the link for the image, but I can't seem to pass the link to the onRelease function anyone can help me on this, below is the code:
[code]...
View 4 Replies
Apr 9, 2010
It seems that with as3, the error compiler is just waiting to get you.I have a function that loads in an external swf. Which swf depends on which button they click. So, it could be pic1.swf, pic2.swf, pic3.swf, etc.
function loadMovie(){
my_mc.addChild(my_Loader);
addChild(my_mc);[code].....
When i test, I get "error: access to undefined property myVariable.
View 3 Replies
Apr 24, 2006
k the idea is that this movie keeps tracks of whatever page it's on using the variable current. when the button evolution is clicked it should jump to frame 2 of the movie whose instance name is contained in the variable current and also pass this variable to a function called alpha which fade that movie's instance when moving to another page - then that page's name will be assigned to current.
this is the code that i have now..
#include "alpha.as"
evolution.onRelease = function() {
this[current].gotoAndPlay(2);
this[current].alpha(5, 0);
};
all these buttons and movie instances are contained in the same movie clip and the variable current is declared in it too.
View 1 Replies
Sep 17, 2009
After having recently just discovered the delights of actionscript, I am at a loss to work this out. I'll explain:I have a series of buttons which, when each one is clicked, need to grab their instance name (this._name), strip the first three characters from it and send it to a global function in another mc within the swf.Instead of stripping the characters, I am happy to do:
if (this._name == dot1) {
dotVar = 1;
} else {
[code].....
View 1 Replies
Mar 17, 2009
I'm trying to write a robust "eventMaker" function that I can run with arguments that will then create an event listener based on the arguments.
However, I can't seem to get it to pass the arguments. Functions are impossible to pass; it can't convert string versions back to functions, and passing the function as type :function just yields "function() function{}".
The same is true with strings and class definitions - if I want it to refer to an object in my other .AS file called "helloWorld", I can't make it think of helloWorld as anything other than a string or an object, and when I write commands based on it I get errors.
So how do I contain classes, functions, et al in variables that I can then reference again, in code, as those functions/classes? How can I convert a string value to something that the code will know is a reference?
View 3 Replies
Jan 18, 2010
How would I go about passing a variable to a javascript function using ExternalInterface?
View 1 Replies
Oct 22, 2011
Why isn't this working as I am thinking it would:
var i:int=-1;
for each(obj in myData)
{
i++;
[Code]....
If I add i to an array (like myArr.push(i)) it will have 3 elements, 0, 1 and 2.
View 2 Replies
Jun 18, 2009
I have shortened this example to keep it simple, otherwise I wouldnt be doint this
I need to pass different variables to function inForLoop each time.
Code:
function someFunction():void {
for (var i:int = 0; i < columns; i++) {
for (var j:int = 0; j < rows; j++) {
[Code]....
View 3 Replies
Apr 9, 2010
It seems that with as3, the error compiler is just waiting to get you.I have a function that loads in an external swf. Which swf depends on which button they click. So, it could be pic1.swf, pic2.swf, pic3.swf, etc.
function loadMovie(){
my_mc.addChild(my_Loader);
addChild(my_mc);[code].........
When i test, I get "error: access to undefined property myVariable.
View 2 Replies
Apr 21, 2010
How do I execute callback functions dynamically by passing a function in as an argument to another function?
Look at this example:
Code:
package {
public class myClass extends MovieClip {
public function myClass(callback) {
[code]....
View 2 Replies
Jan 29, 2012
I have a public variable and I am trying to set it, then read it from a different function:
public var str:String;
public function DailyVerse()
{
function create() {
[Code]....
My trace results says null. Why does it not give me "hello"?
View 1 Replies
Aug 22, 2009
I have a flash file that has an XML driven menuing system to select and play various FLVs. I want to be able to craft different URLs to open the swf and start playing different FLVs. (The others will be accessible from the menu once the sfw is opened, but I am looking to control what plays on opening, dependent on what link a user click.) Not really sure about the best way to get the selection into the swf.
View 4 Replies
Aug 17, 2009
I have a site that uses an user id that needs to be passed from links with a flash banner. I have it working, but not the way I need it and could use a little assistance.
[Code]...
View 4 Replies
Aug 26, 2011
I'm trying to pass the file name of an image upload PHP script into Flash's UILoader component. So when a user uploads their image, the file name of the file is passed to flash so that the image displays within the Flash UILoader application. Here's the PHP variable I'm trying to pass: $filename= ''; And here's where Flash's UILoader gets it's source (ActionScript 3.0): uiLoader.source = "freshly uploaded file.jpg ($filename)?";
View 1 Replies
Aug 13, 2009
i have the php file transfering the correct data but it is not registering as the variable in swfi have already tested the php file and do Know that it is working correctly
I have tested the swf file - no user works but the variable sent for balance is not setting
$select = "SELECT * FROM `auth` WHERE `username` = '$username'";
$result = mysql_query($select) or die(mysql_error());
//how many rows
[code].....
View 0 Replies
Dec 7, 2009
I am using SWFObject2 and passing in a flashvar to the movie it is loading (preloader.swf). I can retrieve the flashvar in preloader.swf no problem at all.The issue is that I am loading another swf from the preloader.swf (lets call it loaded.swf) and I want to get the variable from preloader.swf into loaded.swf - but for the life of me I just can't work out how to do it.If I try and access the variable from the preloader.swf via loaded.swf I just get compiler errors because the variable I want in preloader.swf doesn't exist in loaded.swf
View 0 Replies
Oct 19, 2011
I've got a question regarding passing a variable from PHP webpage to .swf file placed on that webpage.
Example:
Button on a webpage1.php is loading a frame.swf file.
Frame.swf is loading test.swf into itself using
ActionScript Code:
loadMovie("min est.swf", mc);
Button on second webpage2.php is again loading frame.swf file but this time I would like that frame.swf would load test2.swf into itself using ActionScript Code:
[Code]...
View 2 Replies
Nov 1, 2005
I have integrated a swf into another swf. (Actually it is a menu that I have incorporated in my 'main swf'.) When clicking a button in swf no.1 (the menu) I set:
_global.new_value="1" ;
_root.Application.newfunction();
-and then in swf no.2:
[Code].....
View 5 Replies
Apr 5, 2006
I'm trying to pass a variable from my main swf to another one that's being loaded in a container in the main swf. What I usually do is create that variable in the main swf and have the loaded swf fetch it but in this instance I need the loaded swf to have it's own root.
Code:
container._lockroot = true;
container.loadMovie("main.swf");
[code].....
View 7 Replies
Sep 2, 2006
I am at a loss as to why I can't get the "linkto" variable to pass through past the firstImage() function. here is the code:
Code:
delay = 5000;
//-----------------------
[code].....
View 1 Replies
Oct 25, 2006
i have a "campus map MC" that is an attachedmovie clip linked from the library to a scrollpane on the main timeline. there is a "info balloon MC" in the "campus map" with a "close" button on the info balloon that hides the balloon.
the campus map has buttons over each bldg. on rollover/rollout the "info balloon MC" appears and disappears. if you click the button it 'stays' and the button is disabled so that the rollover/out stop.
button code:
Code:
on (rollOver) {
setProperty(this.bubble,_visible, 100); // info balloon MC nested in the campus map MC
setProperty(this.bubble,_x, 200);
[Code]....
View 1 Replies
Jun 29, 2007
I know this should be simple but I can't figure it out for the life of me.
Code:
for(i=0;i<xmlLength;i++){
mainMenu.createEmptyMovieClip(xml[i].attributes.n,mainMenu.getNextHighestDepth());
[code]....
View 3 Replies
Oct 5, 2009
i am passing a variable into an swf using the addVariable seen below
Code:
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("ticker.swf", "background", "293", "107", "8", "#000000");
so.addParam("menu", "false");
[Code]...
View 1 Replies