ActionScript 2.0 :: Calling Function And Passing Parameter?
Mar 11, 2004
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.
View 4 Replies
Similar Posts:
Mar 11, 2004
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.
View 4 Replies
Aug 3, 2010
Let's say I have a function that accepts a function and some arguments as parameters. Something like:
ActionScript Code:
function myFunction(func:Function,args:Array):Void{
// do something awesome here
};
How would I go about calling this function with the arguments in args? It's pretty simple to call a function without any arguments, but calling it with them..
As an example:
ActionScript Code:
// I'd like this call
myFunction(trace,["Hello world!"]);
[Code].....
View 3 Replies
Aug 26, 2008
I know I can do this:
Code:
controller.detachButton.onRelease = function()
{
[code].....
View 1 Replies
Apr 25, 2008
I'm trying to do something like this and it doesn't work, but I get no errors.
callback = function(){
//bla bla bla
}
[code]........
View 5 Replies
Aug 19, 2004
I have several TextInputs in a certain form which have been assigned id in an incremental order. For example:
<s:TextInput id = "index1"/>
<s:TextInput id = "index2"/>
<s:TextInput id = "index3"/>
[code].....
View 8 Replies
Dec 14, 2009
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);
[code].....
View 2 Replies
Mar 19, 2011
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.
View 4 Replies
Apr 6, 2010
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?
View 4 Replies
May 23, 2009
In my code there's a function that shows an image on the screen (or loads the image and shows a progress bar). This function is called by clicking on a thumbnail, and it uses a parameter [e.target.name] refering to the property "name" of the thumbnail clicked, which is an integer (or I believe so). The thumbnails are placed inside the cointaner_mc MovieClip.
Code:
container_mc.addEventListener(MouseEvent.CLICK, clickThumb);
function clickThumb(e:MouseEvent):void{
if (my_full_images[e.target.name] == undefined){[code]...
but I want to call this function by clicking on a button, which would need to pass another type of parameter, in this case, a variable which refers to the number of the image displayed on the screen plus one.I tried this:
Code:
clickThumb(image_num + 1);
But it doesn't work, I get the following error:
1067: Implicit coercion of a value of type Number to an unrelated type flash.events:MouseEvent.
How could I call the function clickThumb and make it use "image_num + 1" instead of "e.target.name" ?
Could I dispatch the event (MouseEvent.CLICK, clickThumb), passing this value "image_num + 1" ?
View 2 Replies
Dec 13, 2004
I have a custom function with parameter. I'm trying to pass the parameter to the gotoAndPlay as follows. This is where the function is called...
Code:
myButton_btn.onPress = function() {
myFunction("Apply");
}
This is the function...
Code:
myFunction = function (fLabel) {
trace(fLabel);
gotoAndPlay(fLabel);
}
Basically "Apply" is a frame label that I'm trying to send the playhead to. The fLabel paramater traces out properly, but the gotoAndPlay doesn't send the playhead to the appropriate frame label. It sends it to 4 frames before the end. It's really weird. Even if I add frames to the timeline, it still sends it to 4 before the end. I can get it to work perfectly in a "new" flash document, but not in my existing document.
View 11 Replies
Jun 16, 2004
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]...
View 3 Replies
May 5, 2010
How to pass a value to a function while its calling thru 'Montion_change' or 'Motion_Finish' or ....
here I try to pass a value to "tweenEvent function" while that function called... i m using a private variable inside 'mainfunction' (dont tell create that variable out the function ), i just assigning a string value to that variable. after this, i m starting a tween and when the tween started calling 'tweenFunction' using addEventListener,
Inside 'tweenFunction' function, i try to trace the 'Name' variable which is inside the mainfunction... not working
[Code]....
View 1 Replies
May 5, 2010
How to pass a value to a function while its calling thru 'Montion_change' or 'Motion_Finish' or ....here I try to pass a value to "tweenEvent function" while that function called... i m using a private variable inside 'mainfunction' (dont tell create that variable out the function ), i just assigning a string value to that variable. after this, i m starting a tween and when the tween started calling 'tweenFunction' using addEventListener,
Inside 'tweenFunction' function, i try to trace the 'Name' variable which is inside the mainfunction... not working.Here my code....
import fl.transitions.*;
import fl.transitions.easing.*;
function mainFunction() {[code].....
View 1 Replies
Feb 12, 2010
I've got an XML file that is loading in data and is calling functions.
how to call the methods from classes with variables set from the XML file:
var functionToCall:String = xml.functions.func[0].to_fire.toString();
myClass[functionToCall]();
This calls the function perfectly.
I was wondering if there is anyway to pass parameters into the function as well through variables. Some functions may have no parameters, some functions could have 5... so the xml could be like this:
[Code]....
View 5 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
Jan 7, 2010
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.
Code: Select allfunction hideButton (elementName:String)[code]......
View 2 Replies
Oct 15, 2004
I'm trying to pass an mc instance as a paramter of a function. is this possible because I keep getting errors.
Code:
function moveCircle(sIncrement:Number, sMovie:String):Void {
sMovie._x +=sIncrement;
}
[Code]....
I'm trying to do this to cut down on redundant functions I've used in the past for simple as movements and controls.
View 2 Replies
Oct 15, 2004
I'm trying to pass an mc instance as a paramter of a function. is this possible because I keep getting errors.
Code:
function moveCircle(sIncrement:Number, sMovie:String):Void {
sMovie._x +=sIncrement;
}
[Code]....
I'm trying to do this to cut down on redundant functions I've used in the past for simple as movements and controls.
View 2 Replies
Feb 2, 2008
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 ?
View 10 Replies
Sep 3, 2009
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();
}
View 4 Replies
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
Jun 2, 2011
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";
[code]....
View 1 Replies
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.
The embed script is as follows:
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="450" id="game-player">
<param name="movie" value="/shockwaves/loader.swf" />
[Code]....
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.
View 1 Replies
Mar 13, 2010
This is something simple, but yet it's killing me...here's my php file contents:
PHP Code:
<?php
$total_rows = 5;
[code]........
View 7 Replies
Nov 12, 2010
So I have a linked external class that has my actual code. On frame one of the flv I have the code:
ActionScript Code:
new main(this.Stage);
The actual main.as contains:
[code].....
View 2 Replies
Dec 1, 2010
how is possible passing parameter inside button.Sample.
for(var i:Number = 0; i<totalArray-1; i++) {
var item_mc = mc.attach.attachMovie("boxEven", "boxEven" + i, i);
item_mc.title.htmlText = item_mc;
[code].....
View 1 Replies
Jan 17, 2010
I have a function that goes like this;
Code:
function goback1(event:Event) {
cont.nums.y=86.5;
[code].....
View 1 Replies
May 18, 2011
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...
Code:
function changeMC(clip) {
clip._x = 50;
clip._y = 50;
}
I want it to work kinda like this...
Code:
function changeMC(clip, unitA, unitB) {
clip.unitA = 50;
clip.unitB = 50;
[code]...
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...
View 3 Replies
Nov 15, 2009
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.
View 20 Replies