A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Help needed about functions

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    83

    Help needed about functions

    code:
    var select:Object = sym01_id;



    this code doesn't give error but this code:

    code:
    function prepareDrag(event:MouseEvent):void {
    var select:Object = sym01_id;
    }



    gives following error:

    1180: Call to a possibly undefined method select.
    var newSymbol:* = new select();

    Can anyone help me?

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    What is sym01_id, a function?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    83
    sym01_id is a library item. The code var newSymbol:* = new select(); is inside another function whose name is firstDrag

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I don't quite understand what you are doing. But as the error states select() is something undefined. The syntax var newSymbol:* = new select(); is used to call a new object like
    var a:MovieClip = new MovieClip(); Also why do you use the * as datatype?
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Member
    Join Date
    Nov 2007
    Posts
    83
    I'm trying to give names to library symbols.

    I don't quite understand what you are doing. But as the error states select() is something undefined. The syntax var newSymbol:* = new select(); is used to call a new object like
    var a:MovieClip = new MovieClip(); Also why do you use the * as datatype?
    Because I don't know what to use. I've tried some types but they didn't work. My other function is:

    code:
    function firstDrag(event:MouseEvent):void {
    if (isMenuOpen==true) {
    var allSymbols:Object = { };
    var str:String = "sym" + num;
    var newSymbol:* = new select();
    allSymbols[str] = newSymbol;
    addChild(newSymbol);
    newSymbol.startDrag();
    newSymbol.x = mouseX;
    newSymbol.y = mouseY;
    newSymbol.buttonMode = true;
    newSymbol.useHandCursor = true;
    newSymbol.addEventListener(MouseEvent.MOUSE_DOWN, dragSelection);
    newSymbol.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
    newSymbol.hitArea = newSymbol.sym01_btn;
    removeChild(menuBack);
    num = num + 1;
    isMenuOpen = false;
    }
    }

    Last edited by onurcan1977; 06-01-2009 at 04:45 PM.

  6. #6
    Member
    Join Date
    Nov 2007
    Posts
    83

    The problem is solved

    code:
    var select:Object;

    function prepareDrag1(event:MouseEvent):void {
    select = sym01_id;
    firstDrag();
    }



    Thanks for helps.

Tags for this Thread

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