steverguy
asked on
Help with understanding the Actionscript 2 code
I'm learning AS3 and trying to dissect source code I received. The source code is in AS2, so i figured converting it to AS3 would help I've stumbled on a portion that I'm not sure what the problem is, but it won't run in AS3. I believe it is because it's not declared properly. Here's the code:
cv = {} //calendar setup vars
cv.horizontalSpacing = 25
cv.verticalSpacing = 25
cv.horizontalOffset = 19
cv.verticalOffset = 69
I don't understand the cv = {} - is this a way of dynamically creating a class in AS2? I've never used it. How would this be declared in AS3?
Thanks for your help!
cv = {} //calendar setup vars
cv.horizontalSpacing = 25
cv.verticalSpacing = 25
cv.horizontalOffset = 19
cv.verticalOffset = 69
I don't understand the cv = {} - is this a way of dynamically creating a class in AS2? I've never used it. How would this be declared in AS3?
Thanks for your help!
ASKER
that makes sense i can find the examples for creating classes.
So for actionscript 2 you only needed cv = {} to create a class?
Thanks for the quick answer, I appreciate the help!
So for actionscript 2 you only needed cv = {} to create a class?
Thanks for the quick answer, I appreciate the help!
no, a class (in AS 2.0) is setup in the below, very basic structure... and make sure you also give the class a file name that matches the class name exactly.. ie MyClass.as
rp / ZA
rp / ZA
// put import statements here
class MyClass
{
// put class properties here
function MyClass(){
// constructor
}
// put class methods here
}
Does it run with AS2?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!
ASKER
Thank you for your help. It was really hard to search for this concept in Google. The author of the code I'm studying uses that method several times - and it seems straight forward, and it didn't make sense that AS3 couldn't handle it.
Thanks again.
Thanks again.
no probs
in AS3 you'll then need to create a cv class.
create it's variables.
if you don't know how to create classes have a look in the help file for examples with explanations.