A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: code hinting...???

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    15

    Question code hinting...???

    Actionscript Code:
    package {
        import flash.display.Sprite;
       
        public class Rect extends Sprite {
            private var rect:Sprite;
           
            public function Rect(x:Number, y:Number):void {
                rect = new Sprite();
               
            }
    }
    }


    I have a custom class and inside its constructor, I need "x" and "y" arguments passed on. Now when I call the class and create and instance of it, flash should pop up "the code hinting"...(but it doesn't), or am I missing something???

    Thanks in advance to anyone who is willing to lend a hand.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You're not doing anything with the x and y parameters you're passing in to the constructor. If you want to set the Rect's position with those, you'll need to do something like this:
    Code:
    public function Rect(x:Number, y:Number):void {
                rect = new Sprite();
                rect.x = x;
                rect.y = y;
    }
    But why do you have a rect Sprite property when you're making a Rect class? You should probably have something like this instead:
    Code:
    package {
        import flash.display.Sprite;
        
        public class Rect extends Sprite {
            
            public function Rect(x:Number, y:Number):void {
                this.x = x;
                this.y = y;
            }
      }
    }
    But you're still not doing anything particularly Rectangle like with that.

    As for code hinting, that depends on your editor, not the language. I strongly suggest you use some other editor for coding, as flash's action pane is just about the worst code editor ever.

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