Parameter Variable With $ In The Name?
Dec 1, 2009
I recently took over an AS3 project someone else programmed. It's quite well done and nicely object oriented. However, I have come across something I have not seen before.
protected function addedToStage ($event:Event) : void {}
The parameter in the function above uses the prefix $ before the parameter name "event". What does this do - if anything?
View 1 Replies
Similar Posts:
Oct 23, 2009
i am trying to define a parameter/variable in my html file and pass it through to the embedded swf file:
Code:
<param name="movie" value="index.swf?wmode=transparent&index=XXX">
...
<embed src="index.swf?wmode=transparent&index=XXX" width="200" height="910" quality="high" pluginspage="http://www.adobe.com/shockwave/download
[Code].....
View 2 Replies
Mar 25, 2010
I have a basic for loop to loop through buttons and set some stuff and onPress handlers:[code]However, as I noticed, all buttonsthen link to one and same frame - all point to last i + 1 - Is there any possibility to call gotoAndStop with "static" Number, so in next iteration, it won't change?[code]
View 1 Replies
Jul 20, 2009
I have a hangup on very basic issue...I am trying to pass a parameter into a variable that gets passed into a function.
Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
var myBtn:String = myFunction();
[Code]....
View 2 Replies
Oct 22, 2009
For the record I am running Flash CS4, but am using actionscript 2.0 (its just what I know, and I don't feel like learning 3.0)-So I'm making a contact list, and each of the names will be clickable to bring up more information. There's going to be a lot of names, so I'm trying to keep the actionscript concise. The code is shown below in a simplified form, but essentially I have created a variable for the hexadecimal color, and I have created a function which will change the text color of each of the name buttons. This works, I have tested it. But, I don't want to have to tell the function to run for every single name button
(eg. changeColor (option1 , testColor);
changeColor (option2 , testColor);
changeColor (option3 , testColor);
etc..)
SO - I tried to create a for loop that would run the changeColor function for each button without typing it a million times. The one below should run from "option1" to "option5" for instance. I originally tried entering the equation "option" + i as a parameter, but it did not work. So I tried the code below where the for loop creates a variable which is assigned the value option1, option2, etc. as it runs through the loop. I added the trace code, and it is showing me that MCname is holding the correct value. However, the changeColor function still refuses to insert the MCname variable as a parameter. The testColor parameter is a variable, and that will work, so why not the MCname one? I also tried replacing the MCname variable with the name of a button (option1) and it runs fine. I just don't want to type in every single option name for the entire list.Sorry for rambling, but I'm trying to fully explain the situation.. If the code is all correct, why won't the changeColor function accept a variable for the first parameter? Is there a way I can get this to work without having to copy and paste the changeColor(option, Color) code for every button (there could be over 100 options)
CODE:
var testColor:Number = 0x33ff00;
function changeColor(buttonName , myColor:Number){
[code].....
View 5 Replies
Apr 9, 2012
How do I use an unevaluated (and/or possibly undefined) variable as a parameter for a function? For example:
function myFun(a:int):void {
a = 5;
}
[code].....
View 2 Replies
Feb 27, 2011
I need a way to wait running the parseCSV command until the readFile event has updated the content of importData. I have seen a few things about custom event dispatchers but cannot quite figure out how to use them in my situation.
private var importData : String;
public function importFile(event:MouseEvent):void {
var data:String = chooseFile();
parseCSV(importData);
[Code]....
View 2 Replies
Aug 7, 2011
I have a function in my flash AS3 file. I'd like to pass a parameter when calling this function and have that parameter become the name of a new FLV playback component I'm declaring;
function newVideo(myVideoName){
var [myVideoName]:FLVPlayback = new FLVPlayback();
}
[code]........
View 1 Replies
Oct 22, 2009
For the record I am running Flash CS4, but am using actionscript 2.0 (its just what I know, and I don't feel like learning 3.0)-So I'm making a contact list, and each of the names will be clickable to bring up more information. There's going to be a lot of names, so I'm trying to keep the actionscript concise. The code is shown below in a simplified form, but essentially I have created a variable for the hexadecimal color, and I have created a function which will change the text color of each of the name buttons. This works, I have tested it. But, I don't want to have to tell the function to run for every single name button
(eg. changeColor (option1 , testColor);
changeColor (option2 , testColor);
changeColor (option3 , testColor);
etc..)
[code]........
View 5 Replies
Jan 28, 2010
I have a function with three parameters, that works fine when I type in the parameter values. The function is tweens(MCname, targX, targY) and it runs properly when I use tweens(btn1, 150, 200) for instance. I need the function to move 6 different movie clips, one at a time, and I am using a variable (Counter) and an if statement to tell the function to run again after one of my tween classes finishes. The code all works, and it will run six times with the same clip if I just type in one of the movie clip's instance names as the MCname parameter. BUT, if I try to use a variable (BTNname) to serve as the MCname parameter, it will not work, making it so I cannot apply the function to my 6 different movie clips. I put a trace on the MCname parameter, and it returns the correct value (btn1, btn2, btn3, etc) but it is not moving the corresponding movieclips. I've tried a number of different methods, but nothing will work..[code]
View 4 Replies
Sep 21, 2011
ok so i've been stuck on this for a while...What i'm trying to do is create a function that updates a global variable (randomVar) that is itself a parameter in the function e.g
[Code]....
Basically, i thought randomVar and vari were the same so when vari was changed randomVar would too but that's not the case. So how do i make the parameter equal the new value(5). I want to repeat the function using different variables so putting randomVar = vari in the function is not possible.
View 5 Replies
May 5, 2009
I'm working on a sliding gallery like Hulu. Setting it up and the sliding slides in and out is working fine. However, I need to add and then remove a button to each slide as it comes in and goes out. (I initially tried including the button on each slide, a mc, but this proved problematic for the event listeners). So when the file loads up, I add a mc to the first slide of the group like so (features[] is an array of movie clips - my slides):
Code:
var goBtn:MovieClip = new FeatureButton();
features[0].addChild(goBtn);
goBtn.x = 350;
goBtn.y = 230;
So I add the button/mc to the first slide - works just fine.
So there are two handlers, next and previous. So I started with the next handler. The first thing I have to do is kill the button on the panel that is sliding out, so I do that like so:
Code:
features[featureCount].removeChild(goBtn);
goBtn = null;
(featureCount is a counter keeping track of the slides). This works fine. I click the next button, and the button on the slide disappears and we move to the next slide - perfect.
So then I add the following next - exactly like I did in the beginning:
Code:
var goBtn:MovieClip = new FeatureButton();
features[featureCount].addChild(goBtn);
goBtn.x = 350;
goBtn.y = 230;
This time adding it to the current slide coming in - but this generates the following error:
Code:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at featuregallery_fla::MainTimeline/nextFeature()
How I'm getting an error on the removeChild() when that is already gone. I assume "parameter child" means goBtn - yes it is null because it's been removed. But I'm not trying to do something with that. I can only guess this is a variable scoping issue with goBtn - but I'm not seeing how to resolve it. Flash file attached.
View 8 Replies
May 7, 2003
I want to create a component with a variable/parameter that is a method it calls when (clicked on for example). In "Flash UI Components.fla" the they do this and I studied the code but cant get it to work. The Push Button one has a click handler, but the way it is actually called in the script is like this:
this.handlerObj[this.clickHandler](this);
That bracket/parenthesis thing is not working.
View 4 Replies
Oct 13, 2009
I want to load variable with multiple parameter link so i will load it in flash Like i have text file like it :
link1=mylink/youlink/ghe&ghik?dfds.blabla.html
link2=mylink/youlink/ghe&ghik?dfds.blabla.html
so how i can load it in flash?
View 0 Replies
Dec 14, 2010
Can we skip an optional parameter and assign value to the parameter after the skipped one?
For example I have a function:
public function Dialog(message:String,title:String="Note",dialogsize:int=99):void
{
}
I can easily call the function with a message and a title:
Dialog("HELLO","Intro");
Is there a way to skip the title and just pass in the dialogsize? I've tried it but can't make it work:
Dialog("HELLO",,dialogsize);
Is it possible to skip some optional parameters without using (rest) parameter?
View 3 Replies
Dec 8, 2009
I am trying to read a XML file and check a parameter for duplicates of that parameter in the file. There could be up to 200 entries with this parameter which is a number. How can I check to see if there are any duplicates?
View 2 Replies
Aug 14, 2009
Forgive me for this stupid noob question but I want to call a function (loadList) that originally gets triggered after a mouseevent from another function (addToXML) that does not have an event.
The loadList function takes info from a XML var, sticks it into an array which then gets loaded into a tile list and that is working fine.
The addToXML function when called adds elements to the XML var after which I want to call the first function with the event parameter so it refreshes the items in the tile list.
I know it can do this by creating a new array and loading that into the tile list in the addToXML function, but it be much simpler to just recall the function.
I have tried things like
Code:
addToXML.addEventListener(Event.COMPLETE, loadList);
but all the event constants I have tried give me error messges like "1061: Call to a possibly undefined method addEventListener through a reference with static type Function."
View 3 Replies
Jun 16, 2011
I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.
I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function
var parameter1:customclass2;
customclass1(parameter1);
in customclass1 constructor:
[code].....
View 1 Replies
Jan 3, 2006
f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:
PHP Code:
<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>
and it would display "success"...or like this:
PHP Code:
<?php$foo = "haha";$$foo = "success";print $haha;?>
and it would also display "success".
View 6 Replies
May 15, 2011
i have a variable take away another variable which makes answer1 variable i then want answer1 to be to the power of another variable how can i do this in flash
View 5 Replies
Jul 18, 2011
I'm have the following URL:[URL] I want to get the arg1 value. I tried to use the following code:
[Code]....
So it requires the # instead of the? How can get the parameter "arg1" from Flex (nicely) from URLs such as: [URL]
View 1 Replies
Aug 29, 2007
Code:
var fruit1:String = "apples";
var fruit2:String = "oranges";
var fruit3:String = "grapes";[code]....
I need the variable fruit1, but for reasons I don't have time to get into, I don't know how to parse these two variables to make a parseable variable.
View 1 Replies
Jul 13, 2009
I would like to build an xml based scroll or purchase one already done, that I can modify the code to look for a unique xml file based on a parameter in the cookie. What would be the best way to go about doing this? Is this even possible? The filename would be unique for each individual user.
View 2 Replies
Aug 4, 2010
I have a game and i'm trying to make changes when a thing happens.I want to do this, when the "caught" flies rise up to "50" increase the value for the flies falling frame per frame.[code]
View 1 Replies
Aug 12, 2009
CS4 was working fine for a few weeks, then yesterday I opened an FLA and got an error pop-up that said "Parameter is Incorrect". The error happened for all FLA files. I could save changes but could not preveiw or publish (same Parameter is Incorrect error as on starting CS4). I even made a blank FLA and it wouldn't work either.
Relized today during more testing that this error only happens any time I open a file that is on my desktop (running XP). Same file moved into another folder (Even desktop ewfolder) works fine.
View 5 Replies
Sep 29, 2009
I am dispatching an event and I would like to add a parameter to the event. Is that possible? The event I have is dispatched like this: dispatchEvent(new Event(CuePoints.TIME_IN, true));and gets listened to like this:
cues.addEventListener(CuePoints.TIME_IN, addDefLink); How can I add a parameter to this? Or would this be done differently? All I want is a uint that gets sent with it each time the event gets dispatched.
View 1 Replies
May 6, 2010
im having problems with the following code:
for (var i:Number=0; i<numFaces;i++){
var faceLoader:Loader = new Loader();
faceLoader.contentLoaderInfo.addEventListener( Event.INIT,
function(fle:Event){
[code]....
The problem is that im sending the variable i to the function LoadCara on every iteration, and its always called with the last value of i. I would like this function to be called with the appropiate index.
View 2 Replies
Nov 2, 2010
i am getting the Parameter url must be non-null error while trying to pass the path of an XML file to an Shockwave flash object.The javascript code is as follows
<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
[code]......
View 1 Replies
Oct 13, 2011
I Want get Param values(src) from Html to AS3 that allows us to maintain in communication our Flash applications with the server. We often need to assign to a SWF a value in entry using the HTML of the page in which the SWF itself is inserted. My Problem is While getting values(src) From html to As3 ,The Html page is working in Intenet Explorer only.I Cannot get in From Mozila and Google Chrome. here my As3 Coding
import flash.display.LoaderInfo;
var sourceId:String = loaderInfo.parameters.src;
trace(sourceId);
Here I cannot Get the Value of sourceId
my Html Coding
param name="flashvars" value="src=f785"
While running my Swf in Html, I take this src Value.Its Working in Internet Explorer Only, It's not Working in Mozila and Google Chrome.
View 3 Replies
Jun 3, 2009
<mx:HTTPService id="addWeb" resultFormat="object" result="Added(event)" fault="faultWeb(event)" showBusyCursor="true" method="GET" url="http://localhost/search/populate.php" useProxy="false">
[code].....
View 1 Replies