Solved

Good Flash application source code

Posted on 2006-10-23
4
176 Views
Last Modified: 2010-04-03
I'm currently having trouble writing Flash classes and eliminating the use of _root and _global. Does anyone have a good suggestion for source code of a flash application with good use of custom classes.

Thanks.
0
Comment
Question by:jpilz
4 Comments
 
LVL 8

Accepted Solution

by:
wildbrookmedia earned 250 total points
ID: 17790876
0
 
LVL 5

Assisted Solution

by:blockage1
blockage1 earned 250 total points
ID: 17927695
Static methods and properties are really useful for the kind of things you might leave on the root or in the global scope. For example if you had a variable called "foo" and you need other classes to be able to access it you could put in a class like so...

class ExampleClass
{
     private static var $foo;
     
     public static function get foo ()
     {
           return $foo;
     }
     public static function set foo ( value )
     {
           $foo = value;
     }
}

then when you need to access it import the class...

   import ExampleClass;

then you can read the variable like this...

   var i = ExampleClass.foo;

and set it like this...

   ExampleClass.foo = "baa"

You can also have static methods too...

class ExampleClass2
{
     public static function myMethod ( )
     {
           // do stuff
     }
}

which you can call like this...

    import ExampleClass2;
    ExampleClass2.myMethod();
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now