Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




AS3 3D Matrix AppendRotation Argument Error



Sir, This is about an error on executing the Adobe Code Help Hint.////URL : file:///C:/Program%20Files/Common%20Files/Adobe/Help/en_US/AS3LCR/Flash_10.0/flash/geom/Matrix3D.html?#appendRotation()appendRotation()method------------------------------------------ public function appendRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):voidAdobe Explanation:The display object's rotation is defined by an axis, an incremental degree of rotation around the axis, and an optional pivot point for the center of the object's rotation.My Usage:spObject.transform.matrix3D.appendRotation(roty,Vector3D.Y_AXIS,Vector3D(-int_my_World_Width,-int_my_World_Height,-int_my_World_Depth));Error:1137: Incorrect number of arguments. Expected no more than 1. ///////////////////// This is the case:I am defining a 3D Cube of that width ,height and depth around its center (Registration as normal 2D thing) and while applying rotation with appendRotation command.But by this adobe Help Example suggestion, i want to Rotate it abound Back-Left-Top corner.But It is giving Error..earlier also I found so many errors while compiling the Adobe Help Examples.I already declared the three variables,for checking and



Adobe > ActionScript 3
Posted on: 01/09/2009 10:06:24 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Argument Error: Error #2108
When i press a certain button in my exported flash (swf file), i get this error message:

ArgumentError: Error #2108: Scene scene 10 was not found.
at flash.display::MovieClip/gotoAndStop()
at create_fla::MainTimeline/mouseDownHandler2()

And the code for that certain button that i pressed on is

stop();
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
gotoAndStop(2,"scene 10");
}

Any suggestions as to what i can do?







Attach Code

stop();
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
gotoAndStop(2,"scene 10");

}

Argument Error
Hello, I have an event listener on a button with a function. How do I use the function outside of the use of the button. I am getting the error that I am missing an argument when I call the function. What argument should be there?








Attach Code

homeScreen(); // what argument should be in the ( )?


homeBTN.addEventListener(MouseEvent.CLICK, homeScreen);

function homeScreen(event:MouseEvent):void
{
//stuff
}

ForEach Argument Error
i just tried this rather simple example to test the forEach method:


ActionScript Code:
var box1:Sprite = new Sprite();
var box2:Sprite = new Sprite();
var box3:Sprite = new Sprite();
var box4:Sprite = new Sprite();
 
with(box1.graphics)
{
    beginFill(0xFFFFFF);
    drawRect(100, 100, 50, 50);
    endFill();
}
addChild(box1);
 
with(box2.graphics)
{
    beginFill(0x334455);
    drawRect(200, 200, 50, 50);
    endFill();
}
addChild(box2);
 
with(box3.graphics)
{
    beginFill(0x996677);
    drawRect(300, 300, 50, 50);
    endFill();
}
addChild(box3);
 
with(box4.graphics)
{
    beginFill(0x118866);
    drawRect(400, 400, 50, 50);
    endFill();
}
addChild(box4);
 
var array:Array = new Array([box1, box2, box3, box4]);
 
addEventListener(Event.ENTER_FRAME, mover, false, 0, true);
 
function mover(e:Event):void
{
    x += 10;
}
 
array.forEach(mover);


and i am getting this error:

ArgumentError: Error #1063: Argument count mismatch on Untitled_fla::MainTimeline/mover(). Expected 1, got 3.
at Array$/_forEach()
at Array/http://adobe.com/AS3/2006/builtin::forEach()
at Untitled_fla::MainTimeline/frame1()

the very weird thing for me to understand is, that it's still working! the boxes move on the function as expected ... what arguments does it refer to?

as always thanks for helping a newbie ...

UILoader Library Bitmap Argument Error?
Can anyone help figure out why, when I try to load a bitmap from the library, I get an argument mismatch error?

ArgumentError: Error #1063: Argument count mismatch on ae(). Expected 2, got 0.

Here's the code:
var flagLoader = new UILoader();
flagLoader.source = mapImg;Note that:mapImg is the symbol's Class identifier of my bitmap - a gif file
putting the symbol name in quotes - "mapImg" yields the same error
the code works perfectly if I substitute a movieClip symbol's Class name.

I've seached hi and lo for answer to this problem. According to Dan Carr, Adobe's migration to AS3 tips (http://www.adobe.com/devnet/flash/ar...plication.html) it should work"...use the second solution I found for dynamically creating instances of symbols.

When the name of the class is not explicitly known, the UILoader class is used, as shown in the code below:

import fl.containers.UILoader;

// Attach movie
var myInstance = new UILoader();
myInstance.scaleContent = false;
myInstance.source = "myClassName";
addChild(myInstance);

Note: This code works well for loading display objects such as bitmaps and movie clips." This clearly wrong. Is there no longer a way to dynamically load a bitmap from the library???
Thanks for any help,
Gordon

Error #1063: Argument Count Mismatch On IPod(). Expected 1, Got 0.
Hi there,

just a newbie. could someone have a look at the following code and let me know what is wrong with the code please?

I get the following error:

Error #1063: Argument count mismatch on IPod(). Expected 1, got 0.

here it is the code:


Code:
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;

public class IPod extends MovieClip {

public var myIPod:IPod = new IPod("A203011GB", "dav's iPod", 11, true);

public function onNextButtonClick(event:MouseEvent):void {
myIPod.onnext();
}
public function onPreviousButtonClick(event:MouseEvent):void {
myIPod.onprevious();
}
public var volumeLevel:uint;
public var myname:String;
public var tracks:Array;
public var currentTrack:uint;
public var shuffle:Boolean;
private var _serialNumber:String;

public function IPod(serialNumber:String, myname:String = "", volumeLevel:uint = 10, shuffle:Boolean = false) {
previousButton.addEventListener(MouseEvent.CLICK, onPreviousButtonClick);
nextButton.addEventListener(MouseEvent.CLICK, onNextButtonClick);
myIPod.tracks = ["Hendrix - Little Wing", "Wu-Tang - Bring Da Ruckas", "Reef - Naked", "The Who - My Generation"];
this.myname = myname;
_serialNumber = serialNumber;
this.volumeLevel = volumeLevel;
this.shuffle = shuffle;
currentTrack = 0;
tracks = new Array();
}
public function onplay():void {
trace("Playing: " + tracks[currentTrack]);
}
public function onnext():void {

if (shuffle) {
//if shuffle is on then we use the Math object to create a random number for the currentTrack property
currentTrack = Math.floor(Math.random() * tracks.length);
} else {
//if it not set to shuffle but we have got to the end of the playlist then we take the currentTrack back to zero (or the beginning)
if (currentTrack == tracks.length - 1) {
currentTrack = 0;
} else {
//if we aren't at the end of the playlist and shuffle isn't set then we just increment the currentTrack number by 1
currentTrack++;
}
}
//After we have incremented the currentTrack we can then call the play function
onplay();
}
//The previous function is basically the exact opposite of the next function
public function onprevious():void {

if (currentTrack == 0) {
currentTrack = tracks.length - 1;
} else {
//If the current track is not 0 then we can decrement the number by 1 using the -- operator
currentTrack--;
}
//Once we have decremented the currentTrack value by 1 we can they invoke the play function to output the track name to the output window
onplay();
}
}

}
Thanks

AMFPHP Error: Invalid Argument Supplied For Foreach() Line 255
I am at a loss what the problem is here. Code snippets and error below:

NetDebugger:

Code:
MethodName: "News.PostArticle"
Parameters (object #2)
.....[0]: "Name"
.....[1]: "Pass"
.....[2]: "Site"
.....[3]: "All"
.....[4]: "Test"
.....[5]: "Test article."

Code:
Status (object #2)
.....code: 2
.....description: "Invalid argument supplied for foreach()"
.....details: "C:wwwwwwrootflashservicesioAMFSerializer.php"
.....level: "Warning"
.....line: 225
PHP Code:
Code:
"PostArticle" => array
("description" => "Post a new article on the site.",
"access" => "remote",
"arguments" => array
(array("name" => "username", "required" => true, "type" => "string"), //userID for posting news
array("name" => "password", "required" => true, "type" => "string"), //password for userID ^
array("name" => "category", "required" => true, "type" => "string"), //category post will be listed under
array("name" => "server", "required" => true, "type" => "string"), //server news is for
array("name" => "headline", "required" => true, "type" => "string"), //headline for news
array("name" => "article", "required" => true, "type" => "string") //actual article
),
"returns" => "NewsID"
)

Code:
function PostArticle($username, $password, $category, $server, $headline, $article)
{//post a new article on the site
$NewsID = 0;
return $NewsID;
}
Flash Code:
Code:
on(click)
{#include "NetServices.as"
#include "Globals.as"
#include "NetDebug.as"

var mainResponder = new Object();
mainResponder.PostArticle_Result = function()
{//
}

NetServices.setDefaultGatewayUrl(GatewayURL);
connection = NetServices.createGatewayConnection();
service = connection.getService("News",mainResponder);
service.PostArticle
(_parent.ti_username.text,
_parent.ti_password.text,
_parent.cb_categories.selectedItem.label,
_parent.cb_servers.selectedItem.label,
_parent.ti_headline.text,
_parent.ta_article.text
);
}

ArgumentError:Error #1063: Argument Count Mismatch On NBar$iinit(). Expected 1, Got 0
I keep getting this error as I make a call to a custom class for instantiation. The only thing is.

A) im sending 2 arguments not 1 which is what the class calls for in the constructor.

B) It is receiving the arguments and the code works and dislpays the movieclips perfectly, yet I still get this error.

I was wondering if this is a bug? And also how I should deal witht this argument error.

Here is the code:

This function makes the instance of the custom class theNav which accepts 2 parameters.

public function popNav(){
for(var i=0;i<navXML.children().length();i++){

var bar = new theNav(xmlArray[i],xmlSubArray[i]);//this array stores XMLList bar.x = posX;

this.addChild(bar);//adds it to stage
posX += bar.width + 5;
}


}

For the sake of time: here is the constructor for theNav...

public function theNav(heading:String, navList:XMLList){
this.listx = navList;
barHeading = heading;

origBar = new nBar(barHeading);
posY = origBar.height+1;
this.addChild(origBar);

this.addEventListener(MouseEvent.ROLL_OVER,navDown );
this.addEventListener(MouseEvent.ROLL_OUT,navUp);



}

any suggestions?

Error 1067 Implicit Coercion Of Matix To Flash.geom.Matrix
I keep getting this error. I even pasted the Adobe help example here which is similar to my code and get the error:



ActionScript Code:
package
{
    import flash.display.GradientType;
    import flash.display.Sprite;
    import flash.geom.Matrix;
   
    public class Matrix_createGradientBox extends Sprite
    {
        public function Matrix_createGradientBox()
        {
             var myMatrix:Matrix = new Matrix();
             trace(myMatrix.toString());          // (a=1, b=0, c=0, d=1, tx=0, ty=0)
             
             myMatrix.createGradientBox(200, 200, 0, 50, 50);
             trace(myMatrix.toString());          // (a=0.1220703125, b=0, c=0, d=0.1220703125, tx=150, ty=150)
             
             var colors:Array = [0xFF0000, 0x0000FF];
             var alphas:Array = [100, 100];
             var ratios:Array = [0, 0xFF];
             
             this.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, myMatrix);
             this.graphics.drawRect(0, 0, 300, 200);
        }
    }
}

"Error #1063: Argument Count Mismatch": AS3.0 Bug?
The very first attempt to write something in AS3.0 stumbled me.


Code:
play_btn.addEventListener( MouseEvent.CLICK, play );
results in runtime error "ArgumentError: Error #1063: Argument count mismatch on flash.display::MovieClip/play(). Expected 0, got 1". On one hand, everything is clear: the listener is expected to accept one argument and the play() function accepts none. One the other hand, everything starts to work fine after wrapping the call to the play() function in a trival closure, also accepting no arguments:


Code:
play_btn.addEventListener( MouseEvent.CLICK, function(){ play(); } );
And as if that's not enough, the Adobe's "Programming ActionScript 3.0" document says on page 131 that "ActionScript 3.0 allows function calls to include more parameters than those defined in the function definition", which kind of implies that the initial code with the direct play() invocation is perfectly legetimate and should not lead to any error.

Any ideas on why it works the way it is? Is this an AS3.0 bug or just my ignorance?

Logic Help: Matrix.b Based Upon Matrix.a Values
Hi ya,

I have always had a hard time figuring out the best way to make a relationship between 2 changing values. Often times I use percents, but in this case that wont work very well.

Anyway, I'd like for the attached movieclip to scale up and then scale back down (and maybe one dip down some). What is the best way to corolate (sp?) these two values?

Cheers



ActionScript Code:
import flash.geom.Matrix;

// set up Matrix filter
var matrix:Matrix = new Matrix();
var totalSkew:Number= -0.3;
matrix.tx = text_mc._x;
matrix.ty = text_mc._y;

// initialize degress and radians
// conversion: radians = degrees * (Math.PI/180);
var radians:Number = 0;
var degrees:Number = 0;

text_mc.onEnterFrame = function():Void
{
    // increment the degrees of rotation and convert to radians
    degrees += 3;
    radians = degrees * (Math.PI/180);
   
    // calculate x scaling
    matrix.a = Math.round(100 * Math.cos(radians)) / 100;
   
    // calculate y skewing
    var range:Number = degrees % 91;
    var percent:Number = (range / 90);
    matrix.b = percent * totalSkew;
   
    // apply transformation
    text_mc.transform.matrix = matrix;
   
}

[FMX] Matrix Algebra And Matrix Inverse
Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.

If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.

A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.

Thanks,
Chris

Passing An Argument Into A Swf
Using the MX 2004 component Loader, Is there a way I can pass an argument into the swf file that is loaded?

Thanks

HELP Asfunction, Xml Argument
i have a function that parses info from a XML doc and loads it into text fields. a sample of the XML looks like this:


Code:
<work>
<project label="sectionONE">
<item label="projName" url="images/projects/project0101.jpg" award=" " link="http://www.yahoo.com" resp="Flash design, etc">My description is here</item>
<item label="projName" url="images/projects/project0102.jpg" award=" " link="http://www.google.com" resp="Flash design, etc">My description is here</item>
</project>
<project label="sectionTWO">
<item label="projName" url="images/projects/project0201.jpg" award=" " link="http://www.yahoo.com" resp="Flash design, etc">My description is here</item>
</project>
</work>
i parse the XML, and use a function that takes an item node, and passes its info into text fields. so something like


Code:
loadInfo = function (itemNode) {
//put itemNode info in text fields
}
this works fine...but i have a XML generated menu which i want to repopulate the text fields depending on which project is choosen...so where itemNode trace to be one of these:


Code:
<item label="projName" url="images/projects/project0101.jpg" award=" " link="http://www.yahoo.com" resp="Flash design, etc">My description is here</item>
i have this on some hrefs:


Code:
this.myText.htmlText += "<font face='Verdana' size='9' color='#00FFFF'><a href='asfunction:mainSecondLine._parent.swfs_mc.loadInfo,"+itemNode+"'><font color='#95D58D'>> </font><u>"+itemNode.attributes.label+"</u></a></font>";
the argument of the asfunction is causing the link not to even display...anyone have a reason why, i am struggling to pass the argument of the node that the link is associated with.
thank you

Fscommand() With Argument
i have external app in C++ is possilble to start the external app with argument too?
It does not work like this:

Code:
fscommand("exec", "save.exe abc"),

Invalid Argument?
Hi everyone!

I'm getting a bogus error when I run a simple jsfl script... This example just uses timeline.setSelectedLayers, but I get it with a lot other layer based functions when I use the layerIndex.

Anyone else get this problem or know a solution?

Thanks!







Attach Code

layerIndex = timeline.findLayerIndex("Layer 1")
fl.trace("layerIndex: " + layerIndex) // prints layerIndex: 0
timeline.setSelectedLayers(0) // works fine!
timeline.setSelectedLayers(layerIndex) // throws me a ''setSelectedLayers: Argument number 1 in invalid." error! huh?!

Argument Passing
If I pass an argument using loadMovie how do I interpret those arguments from the movie that has just been loaded?

Thx

Argument Checking
Hi,
I have what I think is both a simple problem and a simple solution, but I just can't seem to get it to work.

I have a class that has multiple remoting call type methods (ie. it talks to the server and fires other methods on a response or fault). One thing I a need to do is to make sure that all parameters passed to these methods are not undefined or null.

So here is the proposed solution:
ActionScript Code:
var a:String = "ah";
var b:String;
var c:String;
function mainFunc (x, y, z):Void
{
arguments.caller[arguments] = argChk (arguments);
trace ("function arguments: " + arguments);
testParam (x) //traces "ah"
testParam (y) //traces undefined
testParam (z);//traces undefined
}
function argChk (param:Array):Array
{
var newParam:Array = new Array ();
//
for (var i in param) {
[i]//trace (param);
if (param[i] == undefined) {
trace ("parameter " + i + " is undefined");
param[i] = "";
}
newParam.unshift (param[i]);
}
return newParam;
}
function testParam (a):Void
{
trace (a);
}



And this is what I want instead:
ActionScript Code:
var a:String = "ah";
var b:String;
var c:String;
function mainFunc (x, y, z):Void
{
arguments.caller[arguments] = argChk (arguments);
trace ("function arguments: " + arguments);
testParam (x) //traces "ah"
testParam (y) //traces ""
testParam (z);//traces ""
}
function argChk (param:Array):Array
{
var newParam:Array = new Array ();
//
for (var i in param) {
[i]//trace (param);
if (param[i] == undefined) {
trace ("parameter " + i + " is undefined");
param[i] = "";
}
newParam.unshift (param[i]);
}
return newParam;
}
function testParam (a):Void
{
trace (a);
}



As you can see, I can change the parameters once inside the function to be checked, however those are simply references now and not the same parameters being passed onto other nested functions.

If I can get this to work, it will save hours on parameter checking that would otherwise require that I copy and paste a checker in about a jillion places on this project. Any help would be greatly appreciated.

Constructer As An Argument
Hi there

lets say I have defined a class called "Point3d", the file is containing the following code:


Code:
package {
public class Point3d {
public function Point3d(x:Number, y:Number, z:Number) {

}
}
}
Somewhere in a class called "Plane" I have the following constructor:


Code:
package {
import Point3d;
public class Plane{
public function Plane(position:Point3d = new Point3d(0,0,0)) {

}
}
}
As you can see, the default value is a Point3d(0,0,0), but when I compile this using the flex 2 compiler, it says "Parameter initializer unknown or is not a compile-time constant", how do I work around this?

AS2: Function Name As Argument
Is there a way in AS2 to pass a function name as the argumnet of another function and then initialise the function that you passed as an argument?

in other words:


ActionScript Code:
function myFunction(mySecondFunction:Function):Void{
mySecondFunction;
}

LoadClip Argument
When I try to use query strings like this...Code:

someMovieClipLoader.loadClip("someExternalSWF.swf?someVariable=3", someMovieClipHolder);

I get this errorError opening URL "file:///D|/XXXXXX/project/someExternalSwf.swf?someVariable=3"

Argument By Reference
Simple question, but I can't find the answer on Flash documentation.

When creating a function, I would like to pass some arguments by reference. Does Flash (Flash 5) allows me to do this?

Thanks

**Error** TempInit : Line 1, Column 5 : [Compiler] Error #1084: Syntax Error: Expecti
Hi,

I'm trying to convert my AS2 project to AS3. I got rid of all errors but one :

**Error** tempInit : Line 1, Column 5 : [Compiler] Error #1084: Syntax error: expecting identifier before 45.
var 45:MovieClip;

I got no idea what tempInit is, and no where do I declare a variable called 45...

After searching the web for hours I am tired and thus asking for your help.

Thank you,

Error #2044: Unhandled IoError:. Text=Error #2032: Stream Error. Cannot Be Caught
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C|/LocalWorkspace/Simulation%20Platform/sim/assets/conversations/14/Maria/NPC_104.MRK


Hi all, I'm getting this error, and I damn well know why. Its because I'm trying to load a file that doesn't exist. But the thing is, I'm wrapping the code in a try catch, and I'm still getting the error. Also, I'm being told that the error is on this line:


ActionScript Code:
var loader:URLLoader = new URLLoader();

I need to do it this way because i know that some of the files I'm trying to load do not yet exist.

But what could possibly be wrong with this line? And either way, it should be caught by the try, catch. So, whats the problem?



ActionScript Code:
try {
        var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, completeHandler);
       
            loader.load(new URLRequest(_filename));
        } catch (error:Error) {
            trace("DATA: loadAnimData(): Error loading lip synch data.");
        }

String To Argument <--- Any Body Know?
howdy,
just trying to set a variable (supplied by an expression) that picks up text from another variable (supplied by an expression), using script like this:

set ("text" + n + ".info", "_root.info" + n);

except where the text should equal the content of variable _root.info1, info2, etc, i just get "_root.info1" in the fields. what i'm asking is (even though the set variable is set to expression) why won't it allow the expression as an argument rather than a string? is there an easy way of making flash read as argument?

Movie/Button Argument
I have a movie that fades a square of grey in and out. On frame 1, it is opaque, on frame 20, it's transparent, and on 25 it's transparent. I'm trying to set up a button so that it checks what frame the movie is on before making the movie fade in/out so that it won't accidently do the action twice. Tell me if I'm not making any sense, and I'll see if I can't post the movie.

Call Function From Argument
hi,
i need to call a function, whose name is a variable...
(exactly like the setClickHandler() function for the PushButton Component)

example:

Code:
function check(funcCall) {
if(whatEver) {
// i need to call function whose name is the funcCall parameter
}
}



hope you understand what i mean
thanx in advance..

Function Argument Problem
Hi,

Here is something bugging me for a couple of days.

At one point in my script I am defining some variables, which are used in a function chooseModel with 3 arguments. This function connects a listbox with a textfield. The important part of the code is shown here:

.
.
modelName_1 = myModel04.attributes.name;//tracing here is fine
modelDescription_1 = myModel04.firstChild.nodeValue;
urlText_1 = myModel04.attributes.myUrl;//tracing here is also fine
chooseModel(modelName_1,"modelDescription_1","urlT ext_1");
.
.
-------------------
.
.
function chooseModel(model,description,thisUrl){
chooseMenu();
myList.addItem(model,description);
myList.setChangeHandler("chooseMenu");
}
function chooseMenu(myList,model,thisUrl) {
InstanceName_0.text = eval(myList.getValue());
if (myList.getValue() != undefined) {
headline = "Press here for "+model+"'s site."
trace("Modelname=" + model);//gives undefined
trace("URL=" + thisUrl);//gives undefined
}
}

The funny thing is modelName_1 is inserted correctly in the listbox but the trace action shows nothing meaning undefined. Putting it in quotations just makes it a string called "modelName_1". modelDescription is recognized correctly and gives me the corresponding text. However, urlText_1 is again not recognized in the trace action and is undefined. Why is this so? Shouldn't all the arguments be passed on correctly? Or is this related to a listbox phenomenan?

Any hints are appreciated.

Using Argument To Load Swf Into The Movie....
I have this function and i want it to open movie defined by the argument menu.

function mainmenuopen (menu) {
loadMovieNum (??????????, 1);
}

ie.

on(release){_root.mainmenuopen(portfolio);}

i want my function to loadMovieNum("portfolio.swf",1)

So the problem i've encountered is how to tell loadMovieNum that the function argument is the name of the swf file.

I really don't have a clue how to do it...

Anyone?

Thank you!

Command Line Argument
Hi,

I want a solution in Flash 5.

I have 2 flash files named First.fla and Second.fla.

In First.fla i have a button which calls Second.exe with fscommand function

i want to call second.exe and also want to pass an argument.

Like let say if i pass "magic" as the argument then only Second.exe should run or else if the argument is not passed then Second.exe should run and go to a particular scene which should display an error message.

Please help.

Regards,
Raaj

Passing Function As Argument
I'm working on a function that checks the time it takes for a given function to run. I'm using Flash MX and the code looks like this:

function timeCheck(anyFunction){
var startDate = new Date();
anyFunction;
var endDate = new Date();
timeConsumed = endDate - startDate;
return timeConsumed;
}

The principle is that i check the current time, run the given function, then check the time again and take the time difference. My problem is that I don't know how to pass and run the function.

Is this possible to do, and if so, how?

Cheers,
Olle

AttatchMovie() InitObject Argument Help
Hello again,

I am in the process of developing a software application. After trial and error, I can see the most effective way to load my images onto the stage dynamically is using attatchMovie(). Initially I had created objects that contained the paths to loading the images from another directory, and handling key events. Because I am now using attatchMovie(), I no longer need to contain the paths to the images because they are inside the library. My dilemma is that all of the images are going to be loaded randomly, and some images require to be in sequence. For example, one image (which has two parts a, and b) loads a on the screen and then listens for a keyevent which loads b. Some of the images however have three or even four images as opposed to just two. I see that the initobject parameter allows variables to pass arguments to the images being loaded. How can I use this feature to help with the images being loaded, so they know what keypress, and what the image sequence is for that specific object? I realize this might sound confusing so I have included a sample of the script:

This is one of the samples of what I have for the variables of my objects
var KEYPRESS2 = new Object();
KEYPRESS2.Title1 = "Keypress2andAlt01.jpg";
KEYPRESS2.Title2 = "Keypress2andAlt02.jpg";
KEYPRESS2.Command1 = 50;
ALTENTER.Command2 = 18;

Now, I am loading the 1st image called "Keypress2andAlt01.jpg" from the library into my MovieClip():
Mc.attatchMovie("IDLINKAGENAME", 1, ???);

Would I use KEYPRESS2 as the reference of the object variables I need for that image?

If this is true, once I have referenced KEYPRESS2 object, can I then access the variables for that object?

If so what is the syntax of referencing those variables?
Like if I wanted to use a conditional referencing KEYPRESS2.Title2, how could I reference it once it is attatched to my Mc movie clip?

Looking To Settle An Argument On Variables
Hello All. Nice day out.

I am looking for some help here. I have a coworker who says that variables in flash do not "hold" their type. I disagree.

For example, if I declare a variable:
Right = 12;
The variable, Right, knows that it is a num, and that it's value is 12.

My esteemed colleague, claims that Right only knows that its value is 12, and derives it's type from it's assigned value.

Does anyone know who is, in fact, correct?

It may seem like a subtle different, but the answer to this question could cause a major shift in the balance of power in my workgroup, with implications and consequences for years to come...

If you've got any input, I'd appreciate it.

Thanks all.

your fan,

AJ

HELP Asfunction, Xml Argument Breaks
i am using the technique described here to pass multiple asfunction arguments...:

asfunction multiple arguments

these arguments are XML data, and upon using the split method to seperate them, they seem to import incompletely...such as...:


Code:
//XML
<project label="Web">
<item label="Shamrock Larrys" url="images/projects/project_shamrock.jpg" award="&nbsp;" link="www.shamrocklarrys.biz" resp="Identity design web design and development.">Created web presence with strong attention to web standards using CSS for layout.</item>
</project>

//link sending the XML data
this.myText.htmlText += "<a href='asfunction:mainSecondLine._parent.swfs_mc.resetInfo,"+itemNode.parentNode.attributes.label+","+itemNode.attributes.label+","+itemNode.attributes.url+","+itemNode.attributes.award+","+itemNode.attributes.link+","+itemNode.attributes.resp+","+itemNode.firstChild+"'><font color='#95D58D'>> </font><u>"+itemNode.attributes.label+"</u></a>";

//function and trace
resetInfo = function (param) {
argumentArray = new Array;
argumentArray = param.split(",");
for (i=0; i<argumentArray.length; ++i){
trace("Function argument " + i + " = " + argumentArray[i]);
}
}

//would trace out to
Function argument 0 = Web
Function argument 1 = Shamrock Larrys
Function argument 2 = images/projects/project_shamrock.jpg
Function argument 3 =
Function argument 4 = www.shamrocklar


what would cause a break like this?..argument 5 & 6 dont even show up...any ideas...?

MouseEvent Best Practice For Argument Name
I notice some people use the argument name (and reserved keyword?) "event" and some people use their own name for the MouseEvent.

Which is the best practice and why?

-- EXAMPLE 1 --
myButton_btn.addEventListener(MouseEvent.CLICK, fcall);
function fcall(event:MouseEvent):void {
// do this
}

-- EXAMPLE 2 --
myButton_btn.addEventListener(MouseEvent.CLICK, fcall);
function fcall(myUniqueName:MouseEvent):void {
// do this
}

Using Movieclip As Function(argument)
I'm hoping someone can give me some advice...

I've got a movieclip (plane_mc) which contains several (node) movieclips. I've created a function that takes the path to the node movieclips as an argument and I then call this function for each node.
function nodeSetup(node) { ... }Because the nodes are below plane_mc I'm having to include the full path as the argument i.e.:
nodeSetup(plane_mc.node1);Is there a way around this? i.e. within the function can I set the level as plane_mc and then only pass the node name as the argument? Is there any need to do this?

The reason I ask is that I can get (and also set) the properties of a node easily enough (e.g. node._x), but things get a bit more difficult when I try and use the argument with something like:
new Color(node);and I'm wondering whether the above is contributing to the problem...

If I try:
new Color(plane_mc.node1);I get a result... but new Color(node) won't work even though when I trace(node) I get 'plane_mc.node1'.

Not too sure what's going on here... I'm assuming that in this context 'node' isn't getting resolved into the path - I tried:
new Color(eval(node)); but that didn't help.

Any suggestions?

Passing A Function As An Argument
I have a class that builds menu items. Clicking those constructed items does different things depending on the context. It could be gotoAndStop() or it could be to call an object method that displays a submenu or whatever one might do in response to a given event.

The method that constructs the movieclip.onRelease event is in that class I mentioned. I want to pass arguments to it that tell it what to do onRelease. How do I pass the argument and how do I process it in the method that builds the event handler?

Here's something that won't work, but gives the idea of what I want to do:


ActionScript Code:
object.method(aaa, bbb, "string, 2, 3, 4, gotoAndStop(5));

//or

object.method(aaa, bbb, "string, 2, 3, 4, anotherObj.anotherMethod("blah", 1, 2, false));

Then in the class being called by the above methods:


ActionScript Code:
//prior lines of code...
obj.onRelease = function() {
    // the following would have been passed from the above methods
    // and possibly stored in properties, not as literal expressions
    // like what follows
    gotoAndStop(5);
    //or
    anotherObj.anotherMethod("blah", 1, 2, false);
}

Any thoughts?

Function Argument Object
is there an object created when a function gets called that allows you to access the arguments of the function by using that object? sounds confusing... like so:


ActionScript Code:
function whatever(argument1,argument2){
    trace(args[0]); //args would contain 2 values, both arguments
}

Take Asfunction Argument From Text
Hi there,
I'm really stuck on this one.
Say you have a link like this is an htmlText field <a href="asfunction:myFunction,myArgument">someText</a>
Is it possible to someone use the text (someText) from the link as the argument dynamically?
Many thanks
W

Empty Argument For Function
I have this function.


PHP Code:



// function for main menu
function fnMainMenu (x : Number, remMov : Boolean)
{
    if (x == 0)
    {
        //call fn from btn_menu_1_plasticProduction
        
    } 
    else
    {
        //remove mc containerPlastMenu
        timeline.containerPlastMenu.removeMovieClip ();
    }
    // unload Movie from plastic production menu with remMov argument
    if (remMov == true)
    {
        containerSept.unloadMovie ()
    }





My q. is: If I call this fn and I need to set the second argument to true how shall I write it? I do not to change the value of x argument
E.g. in this way?
fnMainMenu (?, true)
I need to keep order of aguments, shall I also instead of question-mark use the default value of this argument?

Function Passed As Argument
I am currently learning ActionScript 2.0 using Flash Professional 8, however, I keep getting an 'Output' error about line 7 in my code which says
The class or interface 'SimpleButton' could not be loaded.
createClassObject(mx.controls.Button, "button"+currentDepth, currentDepth);

I will post the whole code (31 lines including space and comments) if required, but hopefully it is just an obvious syntax error that I cannot spot.

Please help.

Using An Array As A Constructor Argument.
Hey alls.

Having a bit of trouble with this array. I can't seem to set a default for it. I thought this would work..


ActionScript Code:
var aBlankArray:Array = new Array();
public function anyFunction(anArray:Array = aBlankArray){
}

But nope. This throws the error 1047: Parameter initializer unknown or is not a compile-time constant.
Is there a way to do this or will i need to make the array optional?

Thanks.

Default Argument Values?
in AS2.0 you had to do this annoying thing...


Code:
function actCool(itsWorking:Boolean):Void
{
if (itsWorking == undefined) itsWorking = false;
trace(itsWorking);
}
please tell me they fixed this... can you do something like this now?


Code:
function actCool(itsWorking:Boolean=false):void
{
trace(itsWorking);
}
ty in advance!

Maximum Argument Length
Hi, does anyone know what's the maximum length that an argument passed to PHP can be?

I have a Flash (AS2) program calling a PHP function and I need to pass an argument which could get quite long. If there is limit, how can I write my AS/PHP functions so that the entire argument can be broken down in smaller packets and sent a bit at a time?

Argument Count Mismatch
Hi,

I'm adding an Event.ENTER_FRAME to my script and getting it to call a function named test.

When I run my application I get an error saying that my test function expected 0 arguments but got 1.

I'm not passing it any arguments so I dont understand why it giving out?

Even if I comment out all of the code in my test function I still get an error. So maybe it has something to do with how I'm declaring the event ? I really dont understand

thanks
dub








Attach Code

public function preloadAudio():void {
audioLoaderRequestA = new URLRequest("bulk.swf");
audioLoaderA.load(audioLoaderRequestA);
audioLoaderRequestB = new URLRequest("bulk2.swf");
audioLoaderB.load(audioLoaderRequestB);
//audioLoaderA.addEventListener(Event.OPEN,showPreloader);
//audioLoaderA.addEventListener(ProgressEvent.PROGRESS,showProgress);
//audioLoaderA.addEventListener(Event.COMPLETE,showLoadResult);
//*>>> Here is where I add my event listener
this.addEventListener(Event.ENTER_FRAME,test);

}
//*>> This is the handler my enter frame event handler uses
public function test():void {
Container.addChild(preloader);
Container.addChild(loadProgress_txt);

var totalBytes=(audioLoaderA.bytesTotal+audioLoaderB.bytesTotal);
var totalBytesLoaded=(audioLoaderA.bytesLoaded+audioLoaderB.bytesTotal);
trace("totalBYtesLoaded"+totalBytesLoaded);
var sclbar=Math.round(totalBytesLoaded*100/totalBytes);
preloader.gotoAndPlay(sclbar);
if (totalBytes==totalBytesLoaded) {
trace("totally loaded");
Container.removeChild(preloader);
Container.removeChild(blockUser);
this.removeEventListener(Event.ENTER_FRAME,test);
}
}

Passing A Function As An Argument
Hi everybody,

My question is slightly complicated : I have a global function that does some stuff with a LoadVars in it.
I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded.

Is there a way to pass a function reference to a function so that I could do something like that :


ActionScript Code:
_global.function myFunction(maybeFunction){   myLoadVars = new LoadVars();   if (maybeFunction != undefined)       myLoadVars.onLoad = maybeFunction;   else       myLoadVars.onLoad = function(ok)      {         [...]      }   myLoadVars.load("...");}


If not, any other Idea ?

Sending An Argument To A External SWF
Hi,

I'm working on a flash website with PHP integration. My doubt is how to load a external SWF passing to it variables as arguments?

Example: I have a SWF that is a search form, the results are shown in this SWF. The results are the name of a person, when somebody click on the result (name), a new "window" open and show more details about that user.

How to pass to this new window the ID of the name clicked?

Another question: In the search form, the "OK" button will call a PHP page that returns with the search's results. I'm thinking in format the data in array's like:

search_data[[id,name],[id,name],[id,name],...] or two arrays:

search_id[id,id,id,...]
search_name[name,name,name,...]

With that, I can create the search list with buttons. What do you think?

Thanks everybody

Command Line Argument
Dear All,

I am run the Flash Application in the Command Prompt
like
Application.exe

i send the some parameter in the Command Prompt
like
Application.exe Param_val1

how can i get the value(Param_val1) in the flash Application

very urgent help me

Regards

sathish

Command Line Argument
Dear All,

I am run the Flash Application in the Command Prompt
like
Application.exe

i send the some parameter in the Command Prompt
like
Application.exe Param_val1

how can i get the value(Param_val1) in the flash Application

very urgent help me

Regards

sathish

Passing A Function As An Argument
Hi everybody,

My question is slightly complicated : I have a global function that does some stuff with a LoadVars in it.
I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded.

Is there a way to pass a function reference to a function so that I could do something like that :


ActionScript Code:
_global.function myFunction(maybeFunction){   myLoadVars = new LoadVars();   if (maybeFunction != undefined)       myLoadVars.onLoad = maybeFunction;   else       myLoadVars.onLoad = function(ok)      {         [...]      }   myLoadVars.load("...");}


If not, any other Idea ?

Copyright © 2005-08 www.BigResource.com, All rights reserved