[Flashcoders] as3 classes var query

2008-06-12 Thread Johnny Zen
Hi all I am currently learning AS3, and I seem to be a bit confused on understanding accessing variables outside of the class it resides in. for example: package test { public class test extends Sprite { public var hello = hello; } }

Re: [Flashcoders] as3 classes var query

2008-06-12 Thread Eduardo Omine
package test { public class test2 extends Sprite { var testInstance:test = new test; trace(testInstance.hello); } } -- Eduardo Omine http://blog.omine.net/ http://www.omine.net/ ___ Flashcoders mailing list

Re: [Flashcoders] as3 classes var query

2008-06-12 Thread Piers Cowburn
You'd need to instantiate the other class and then access it, like this: package test { public class test2 extends Sprite { public function test2(){ var testInstance:test = new test(); trace(testInstance.hello); } } } Also, it's good

RE: [Flashcoders] as3 classes var query

2008-06-12 Thread Merrill, Jason
You'd need to instantiate the other class and then access it, like this: That's one way, the other way is to use static variables: package com { class MyClass { public static var name:String = Johnny; //or declare as a public

Re: [Flashcoders] as3 classes var query

2008-06-12 Thread Johnny Zen
Ah thanks for all the help everyone. I'm slowly coming around to classes, as has been confused about when and when not to use classes and how to access the information from each other. interesting. Thanks again :) On Thu, Jun 12, 2008 at 3:38 PM, Merrill, Jason [EMAIL PROTECTED] wrote: You'd