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


Similar Posts:


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 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 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 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

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

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

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 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 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

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 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 :: 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

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 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 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

ActionScript 2.0 :: Filling Function Arguments With Array Items, Function.call()?

Feb 28, 2008

I have this code but I cannot work out how to fill in function parameters based on an array and it's length, see line 7

[AS]
import com.robertpenner.easing.Cubic;
MovieClip.prototype.framesTimeout = function(func:Function, frames:Number, args:Array) {

[code]....

Is it possible to call a function and fill in the parameters based on an array and it's length?

View 1 Replies

ActionScript 3.0 :: Length Of Function Arguments And Display Function

Sep 21, 2010

i have a question i have a primary and secondary function which i want it to be dynamic so i can get the user to enter in six to seven different or as many as required argument parameters for my primary function

[CODE]...

View 5 Replies

ActionScript 3.0 :: Getting 4 Parameter Arguments Into A Function From XML?

Jan 1, 2010

I'm designing a game that uses this function;

function moveBars(Bl:Number,Gr:Number,Or:Number,Ye:Number)
{
blueBar_mc.scaleX += Bl;
greenBar_mc.scaleX += Gr;
orangeBar_mc.scaleX += Or;
yellowBar_mc.scaleX += Ye;
}

When moveBars is called, the length of the 4 colored bars change to indicate how the player is doing in different areas of the game, like so; moveBars(.1,-.2,.3,-.1)

My problem; I need to store the moveBars parameter arguments in XML like so;

<myArgs> .1,-.2,.3,-.1 </myArgs>

But I can't find the way to get those 4 numbers into the moveBars parameters from the XML doc. Is there a way to do this?

View 5 Replies

Flex :: Call() Of Function With Arguments?

Sep 4, 2009

I have a component that I hand over a function

public var func : Function;

Now the function is a function that has parameters in its signature

public function myFunction(s : String) : void {
doSomething(s);
}

from my component I can call the function with

func.call();

how to invoke the function with its parameters?

View 1 Replies

ActionScript 3.0 :: Possible To Add Optional Arguments To A Function?

Nov 19, 2009

I want to add things to the display list, some will have event listeners and some not. Is it possible to make an argument optional so it doesn't throw an error if it's not there when calling the function?

View 2 Replies

ActionScript 2.0 :: Pass Arguments To Function?

Jan 21, 2003

I'm having a little problem with how to use the argument sent to a function.I have this:

Code:
_root.onEnterFrame = function() {
setPanning(1);

[code].....

View 3 Replies

ActionScript 2.0 :: Getting Value Of Arguments.caller Within A Function?

Feb 18, 2005

Is it possible to trace the name of arguments.caller property?

I tried

Code:
trace (arguments.caller.toString());
but that doesn't work.

View 4 Replies

ActionScript 2.0 :: Moviecliploader Function How To Get Arguments

Jul 6, 2007

I dont want it like the classic way listenerThumbs.onLoadInit = function(target_mc:MovieClip)But with the Proxy.create class, how do I get the arguments of the moviecliploader? (ex: target_mc, loadedbytes, totalbytes)Now I did it like this, but it has to be different.[code]

View 1 Replies

ActionScript 2.0 :: Getting Value Of Arguments.caller Within A Function

Feb 18, 2005

Is it possible to trace the name of arguments.caller property? I tried Code: trace (arguments.caller.toString()); but that doesn't work.

View 4 Replies







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