A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Object visibility

Threaded View

  1. #8
    Junior Member
    Join Date
    Apr 2010
    Posts
    18
    Your issue is arising because you are trying to use AS3 syntax yet create your project in an AS1 way.

    You should be using the document class, and dynamically adding your content. Using the timeline is an AS1 way of doing things and as you can see has already gotten you into trouble before you even got very far.

    ------------------------------------------


    Here is a quick example of what I mean, how you should be controlling everything from a document class --> other classes.

    Actionscript Code:
    package _as {
       
       
       
       
       
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
       
       
       
       
       
        final public class index extends MovieClip {
           
           
           
           
           
            protected var oblast_mc : MovieClip = new oblast ( );
            protected var televize_mc: televize = new televize( );
           
           
           
           
           
            final public function index (  ) {

                this.oblast_mc.addEventListener ( MouseEvent.MOUSE_UP, this.toggleTV );
               
                this.addChild ( this.televize_mc );
                this.addChild ( this.oblast_mc );
               
            }

            final private function toggleTV ( evt : Event ) : void {

                this.televize_mc.visible = !this.televize_mc.visible;
               
            }
           
           
           
           
           
        }
       
    }
    Last edited by truimagz; 09-26-2011 at 04:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center