actionscript 3 - Global variables in action script 3 -


i'm new in action script 3. intend use global variable.

here way this , this

i download simple banner here

create file globe.as in same directory test_banner_actionscript_3.fla. globe.cs contains next code

package  {   public class main    {      public static var mypencil:number = 3;   } } 

banner code looks

mybanlink.addeventlistener(mouseevent.click, mybanlinkclicklistener);  function mybanlinkclicklistener(e:mouseevent):void {     trace(main.mypencil); //3     var url:string="http://www.web-article.com.ua";     var urlrequest:urlrequest=new urlrequest(url);     navigatetourl(urlrequest); } 

but

error: 1120: access of undefined property main 

interesting intellisense suggests "mypencil" when typing "main."

what's wrong?

you possibly forgot import main in begin of banner code. remember, when use class, check class imported.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -