#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Get a symbols own coordinates


    Alright, this is probably something thats solved verry easy, but I tried all kinds of google terms etc and I can't find a solution.

    On my stage, I have a symbol, in this symbol (button) the following code:

    Code:
    on(press)
    {
    	startclick = 1;
    }
    
    on(release)
    {
    	if(startclick == 1)
    	{
    		// Scale to a sector
    		_root.map._xscale2 = 100;
    		_root.map._yscale2 = 100;
    			
    		// Move the map
    		_root.map._x = _root.mapmaskleft-this._x;
    		_root.map._y = _root.mapmasktop-this._y;
    	}
    }
    Now, the

    // Move the map
    _root.map._x = _root.mapmaskleft-this._x;
    _root.map._y = _root.mapmasktop-this._y;

    Is the important bit. Whenever this code is executed, flash
    doesn't take the co÷rdinates of the symbol this is running on,
    but the co÷rdinates of the stage the symbol is on.

    From the documentation, the this keyword is doing exactly that, so it's working properly. I just need the _x and _y of the symbol this code is running. The symbol doesn't have an instance name because I don't want that because I need to copy it a few dozen times and editing the code in each
    instance is a hell of a lot of work.

    Is there a solution for this without giving the symbol and instance name and getting the _x and _y trough this intance name?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    fap


    fap fap fap
  4. #3
  5. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,678
    Rep Power
    3165
    this would be in the scope of the onRelease event handler so if that function is defined inside the symbol then this would refer to the symbol. You can check for sure by putting a trace(this); in there.
    Quis custodiet ipsos custodes?

IMN logo majestic logo threadwatch logo seochat tools logo