| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Dec 2003
Location: Cincinnati
Posts: 3
|
How do I substitute a variable in for the named arguments in the addNewRectangle method of JSFL?
Instead of this: flash.getDocumentDOM().addNewRectangle({left:0,top :0,right:100,bottom:100},0); I need to do this: flash.getDocumentDOM().addNewRectangle({left:myvar[0],top:myvar[1],right:myvar[2],bottom:myvar[3]},0); I keep getting the message "argument number is not valid". I've tried building the parameter string ahead of time, and I've tried using the eval() function, but still can't get past this error. Anybody else have any ideas? Thanks! |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Apr 2004
Posts: 28
|
nothing wrong with your code except the way you probably defined your array().
here are 3 ways. var myvar = [ 0, 0, 100, 100 ]; or var myvar = new Array(); myvar[0] = 0; myvar[1] = 0; myvar[2] = 100; myvar[3] = 100; or var myvar = new Array(); myvar.push( 0 ); myvar.push( 0 ); myvar.push( 100 ); myvar.push( 100 ); ------------ any of those 3 ways you choose will work with your code. flash.getDocumentDOM().addNewRectangle({left:myvar[0],top:myvar[1],right:myvar[2],bottom:myvar[3]},0); |
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|