ActionScript 2.0 :: Passing Arguments To Functions?

Dec 31, 2002

i have a music jukebox, with ten buttons. in the first keyframe, of the main timeline, a put a function that will be used for every button to load the mp3 to play. The problem, is that when i pass the arguments on each button to call the function, the "filme" and "som" arguments are lost.

here is the function:

function carregaSom(filme, som, url, msg1, msg2, tempoComeco){
_root.createEmptyMovieClip(filme, 1)
som=new Sound(filme);

[Code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Passing Variable Names As Arguments For Functions?

Sep 24, 2008

Is it possible to pass variable as arguments for a function? I wish to update a boolean variable via a function, by passing the name of the variable to the function, like so:

Code:
function ENVSegment(curSegment:Boolean, nextSegment:Boolean) {
curSegment = false;
nextSegment = true;
} var attackSegmentIsRunning:Boolean = false;
var releaseSegmentIsRunning:Boolean = false;
[Code] .....

Much shorter, and easier to understand. Also, less repetition of the same blocks of code over and over...

View 1 Replies

Flex - Passing Optional Arguments (rest) Through To Another Method That Takes Optional Arguments?

Feb 3, 2010

I have a "format" method that works in a similar manner to the C# String.Format method, with the following signature:

[Code]...

View 3 Replies

ActionScript 2.0 :: Functions Passed As Arguments To Other Functions?

Nov 9, 2005

I have a function with 4 necessary arguments (aka parameters) in order to perform the actions. I would like to have the ability to pass the same function to itself as an argument (sort of like a recursive function) along with its arguments. Basically I want to "base" to engage an onMotionFinished event handler if there is another function passed as an argument. Something like...

[Code].....

Would there be a way to use listeners to do this or the AsBroadcaster?

View 6 Replies

ActionScript 3.0 :: Passing Arguments With AC_FL_RunContent()?

Jun 9, 2009

I need to pass some value, say 'name=john', from html to actionscript.I am now using AC_FL_RunContent as;

AC_FL_RunContent(
"src", "newFile",.... );

here the movie is mensioned as 'newFile'.. how do pass the value 'name=john' to the actionscript code.what I need is something equivalent to "newFile.swf?name=john".

View 1 Replies

ActionScript 3.0 :: Passing In Arguments From Js --> Via ExternalInterface?

Jun 17, 2011

Is it possible to use javascript to call a method in as3 and pass in an object argument?This would act as a setter in some sense.

View 4 Replies

ActionScript 2.0 :: Passing Arguments To Function?

Oct 8, 2009

I have a movie clip that contains several movie clips, only one of which should be shown at a time. Which one is shown, depends on what buttons the user selects.Having trouble with the syntax for passing the argument in a button to the function that controls the tweening of the clips. (When I hard code the references into the function, it works, so I know the basic function is ok).There's a clip called 'slide1_mc' which contains various MC's to be shown based on user selection (in this case, using 'system' clip as the first one already showing). Here's the code in the parent clip of that item:

Code:
var currSection = slide1_mc.system_mc;
function changeSection(newSection):Void {
TweenLite.to(currSection,.3,{_yscale:200, _xscale:200, _alpha:0});

[code]....

Here's one of serveral buttons that will control the content to be seen:

The code in the button is:

Code:
var changer = slide1_mc.software_mc;
smallButton.onPress = function() {
_parent.changeSection(changer);
};

So - the initial part of my function works so I know my 'external' initializing of "currSection" is working (that clip is zooming/fading out)... but then the clip that I want to fade in isn't doing anything.

View 0 Replies

Actionscript 3.0 :: Passing Arguments To Php Function

Apr 8, 2009

i have been playing with the Zend Tutorial - and all works fine... however, stuck on something that i found quite easy in amfphp/as1&2

In AS3 - i am using NetConnection and i want to pass arguments to my php function

The first function i show here works fine....

inMyPhp...

Code: Select allpublic function getTutorials()
{
$result = mysql_query("SELECT * FROM testTable");
$t = array();

[Code].....

View 1 Replies

ActionScript 2.0 :: Passing Arguments By Reference?

May 12, 2005

Is it possible to pass arguments "by reference" instead of "by value". I know it's possible in almost every programming/scripting language I came across until today, but I didn't find any hint for doing it in Actionscript For those who don't know what "by reference" means: If you want to pass a Number to a function, say

Code:
var mynumber:Number = 5;
calculate(mynumber);
and you change the value of the argument inside the function, e.g.

[code]....

then the call to calculate normally does NOT change the value of mynumber because you have passed mynumber "by value", which means the value of mynumber has been copied to the num argument. This means mynumber is 5 all the time.Now sometimes u want to be changing arguments given to a function inside the function, and this is where u will normally use references. Passing mynumber "by reference" would mean that after calling calculate the value of mynumber will be 6...I know complex Objects like MovieClips are passed by reference. But how to do it with simple DataTypes like Number, Boolean etc.?

View 3 Replies

ActionScript 3.0 :: Passing Arguments To Php Function?

Apr 8, 2009

In my database i have a field called "live", and i only want to grab entries in a table that have "live" set to "1"

This is what i have tried, but it doesn't work....

InMyPhp...

PHP Code:

public function getTutorialsLive($live) 

$result = mysql_query("SELECT * FROM testTable WHERE live = '%s';", $live); 

[Code]....

View 1 Replies

ActionScript 2.0 :: Creating MovieClips Through Functions With Arguments?

Sep 17, 2009

I have the following code, which should display some square clickable clips over a map. This is done by calling a function (shown below) with arguments. However, when I call this function, only the last box is shown... The clips are drawn on the same level (9000) but that should not be a problem as they wont overlay...functions calls....

ActionScript Code:
clipsideD=150;
city="Rome"
cityText=romeText

[code]....

View 1 Replies

ActionScript 2.0 :: Call Functions And Pass Arguments?

Apr 22, 2008

Way to call a function that DOES NOT accept arguments.[code]...

How about the SHORTER way to call a function that ACCEPTS arguments?

View 2 Replies

ActionScript 3.0 :: Passing Content Of Array As Arguments

Jul 14, 2009

You can do this:
PHP Code:
public function (args ...)

To take in any number of arguments. Is it possible to then give the content of that args array to a new function:

PHP Code:
public function bla (args ...){
pleh( changeArrayIntoArgs(args) );
}

So that that would be the same as just passing arguments manually. lets say bla got 3 arguments:
PHP Code:
bla(v,vv,vvv);

So that bla then executes:
PHP Code:
pleh(v,vv,vvv);

View 3 Replies

ActionScript 3.0 :: Passing Arguments With Event Listeners?

Nov 11, 2009

I am fairly new to AS3.
vancouverMC.dotsBttn.addEventListener(MouseEvent.M OUSE_OVER, mcIn(vancouverMC));
vancouverMC.dotsBttn.addEventListener(MouseEvent.M OUSE_OUT, mcOut(vancouverMC));
function mcIn(mcName:MovieClip):void{
mcName.gotoAndPlay("in");
mcName.ringMC.gotoAndPlay("on");
} function mcOut(mcName:MovieClip):void{
mcName.gotoAndPlay("out");
mcName.ringMC.gotoAndPlay("off");
}
Why this is Not Working?

View 2 Replies

ActionScript 3.0 :: Passing Arguments With Event Listners?

Nov 11, 2009

tell me why this doesn't work?

vancouverMC.dotsBttn.addEventListener(MouseEvent.M OUSE_OVER, mcIn(vancouverMC));
vancouverMC.dotsBttn.addEventListener(MouseEvent.M OUSE_OUT, mcOut(vancouverMC));
function mcIn(mcName:MovieClip):void{

[code]......

View 3 Replies

ActionScript 3.0 :: Passing Arguments To Constructor Of Symbol?

Jul 15, 2010

I've drawn a pretty button in Flash and given it the Class name PausePlayButton. It extends PlayerController, which allows it to toggle on and off and control whether a MovieClip is playing or not.When I instantiate it, I want to pass a reference to the MovieClip it controls into the contructor so that PlayerController has access to the MovieClip's public methods. However, I can't pass a reference into the constructor of PlayerController, unless I can pass it into the constructor of the symbol itself and call super. But where is that constructor? How do I give the button a reference to another object?

View 1 Replies

ActionScript 3.0 :: Passing Boolean Arguments To A Function

Jul 20, 2010

How to pass boolean arguments to a function[code]On the stage i have all the MC - screenX, alarmsX, criticalX, majorX,warningX, redX, orangeX, greenX.But i get errors:Scene 1, Layer 'Layer 1', Frame 1, Line 171119: Access of possibly undefined property visible through a reference with static type Boolean.for each of the MC.

View 9 Replies

ActionScript 3.0 :: Object Pooling And Passing Arguments

Feb 22, 2011

I just started using object pooling and I have some problems with passing arguments. I made class "Circle" which needs 3 arguments when instanced and I try to push it into the pool.

[Code]....

View 4 Replies

ActionScript 2.0 :: Passing Additional Arguments To Function?

May 20, 2008

I have four NetStream objects that receive cuepoints from different videos. I'd like to define one function for them all instead of using four inline functions and I'm stuck with syntaxHere's the code:

Code:
ns1.onCuePoint = callCuePoint;
ns2.onCuePoint = callCuePoint;

[code].....

View 4 Replies

IDE :: Passing Arguments To Event Handlers In Loop?

May 8, 2009

Say I have an array with 4 string elements that are 4 different urls. On the stage I have 4 movieclips that I want to have listen for a CLICK event. When the user clicks a button, the navigate to one of the 4 urls.I can loop through the buttons and add and event listener to each:

Code:
private function applyPlankLinks():void {
for (var i:uint = 0; i<numberOfPlankBtns; i++) {

[code].....

View 2 Replies

ActionScript 3.0 :: Passing Functions Through Functions From Different Classes?

Dec 27, 2009

Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:

Code:
public function doSquareFunction(thisFunction:Function):void{
square1.thisFunction();

[code]......

View 8 Replies

Actionscript 3 :: Creating Anonymous Functions In Loop With Not The Same Arguments

Dec 25, 2010

I want to make in loop set of buttons, and add to them some events, but anonymous functions is the same. I write example code:

for(var i:int=0;i<5;i++)
{
var button:SimpleButton = new SimpleButton(...);
...

[Code]....

And I want to trace 0,1,2,3.. from click buttons instead of 4,4,4,4 ..

View 1 Replies

ActionScript 3.0 :: Passing Arguments To A Custom MC Class Constructor?

Oct 30, 2011

I'm having trouble with the constructor for a custom Class tied to a library MovieClip.
 
Say I have a MovieClip in my library named Circle, which is tied to the class com.shapes.Circle . I want the Circle class contstructor to take 2 arguments, xScale and yScale:
 
public function Circle(xScale:Number, yScale:Number) { }
 
However, if I try to call that from in code, for example Circle ball = new Circle(3.14,2.0); , I always get an "Incorrect number of arguments. Expected 0" error.
 
Is it possible to have a custom class tied to a MovieClip that can take arguments, or does Flash not allow this? I'd asked about this before and thought I figured it out, but from looking at it now I apparently hadn't figured it out and had resorted to a sloppy workaround; I'm hoping to fix it now.

View 12 Replies

ActionScript 2.0 :: Passing Function Arguments Via Call From ContextMenuItem?

Feb 10, 2009

Is there any way to pass an argument to a function being called by a ContextMenuItem?The effect I want would be what one might expect from this pseudocode:

Code:
var cm = new ContextMenuItem("Start Alt", set_row_style('start_alt_here'), separatorBefore=true, enabled=true, visible=true);

Which obviously doesn't work, or I wouldn't be asking.So far I've tried using the captions as a basis for a switch condition, which works.

Code:
function set_row_style(obj, cm) {
switch (cm.caption) {
case 'start_alt_here' :
...

But I'd rather not use an arbitrary string as part of a function.The only other option I see is using a listener for each ContextMenuItem, then calling the function with its arguments from there.Is there any more direct a way to pass an argument to a function from a ContextMenuItem?

View 1 Replies

ActionScript 2.0 :: Passing Arguments Into A Function Member Of An Array?

May 20, 2007

I want to have an array, where each value is a function, where each function also has a set of arguments.

What is the correct syntax for setting a value of an array as a function?

Lastly, how do I pass arguments into the array's value?

Code:
var funcA = new Function(a:Number, b:Number){return a + b};
var funcB = new Function(a:Number, b:Number){return a - b};
var funcC = new Function(a:Number, b:Number){return a * b};

[Code].....

View 1 Replies

C++ :: Communicate Between AIR(Flex) And Applications - Call Functions And Pass Arguments To Each Other

Sep 30, 2009

I need to be able to communicate between two applications that reside on the same machine. One is using Flex and the other is in C++. I would like to be able to call functions and pass arguments to each other. What is the best way to communicate between them?

View 3 Replies

Flash :: Passing Arguments Into A Function Located In A Separate File?

Jun 24, 2011

I'm an AS3 noob who is trying trying to get more comfortable with passing arguments into functions.why when the following code is all in one AS3 file as seen below it works and draws the purple square...

package{
import flash.display.*;
public class Main extends Sprite{[code]............

Flash CS5 gives me an error message 1137 saying that it was expecting only 1 argument in the code line --> Fill(square_commands, square_coord);I need to pass the arguments square_commands and square_coord into the function in the second AS3 file?

View 2 Replies

Actionscript 3 :: Access The Main Class's Stage + Pass Functions As Arguments Like This?

Jan 22, 2011

There are two files in my actionscript project named "TestAPP", TestAPP.as and Draggable.as

TestAPP.as:
package {
import flash.display.Sprite;
import flash.display.Stage;[code].....

In "my actionscript theory", I'm supposed to see a circle that follows the mouse when I click it. (The draggable is not fully implemented) But the circle doesn't even budge .how to access the main class's stage property. I've googled for it, but still no progress.

View 4 Replies

Actionscript 3 :: Flex Adding Event Listeners With Callback Functions Which Have No Arguments

Jun 10, 2009

fileReference.addEventListener(Event.COMPLETE, uploadCompleteHandler);
private function uploadCompleteHandler(event:Event):void {}

Above is one way to add an event listener in Actionscript. By default the callback function needs to have an argument with name event and type Event. Is there a way to declare this function without any arguments :

private function uploadCompleteHandler():void {}

Edit : It's possible to add an event handler without any arguments in mxml. So one student wanted to know, why isn't it possible to do the same in actionscript?

View 2 Replies

ActionScript 3.0 :: Passing Functions From Different Classes?

Dec 27, 2009

Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:

Code:
public function doSquareFunction(thisFunction:Function):void{
square1.thisFunction();

[code].....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved