Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 27th, 2011, 12:35 PM
Martin Thompson Martin Thompson is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 2 Martin Thompson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 0
ActionScript 2 - 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?

Reply With Quote
  #2  
Old July 16th, 2011, 12:11 PM
Martin Thompson Martin Thompson is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 2 Martin Thompson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 0
fap

fap fap fap

Reply With Quote
  #3  
Old July 16th, 2011, 06:56 PM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 6,663 Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)Tann San User rank is General 33rd Grade (Above 100000 Reputation Level)  Folding Points: 14767 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 3 Days 20 h 9 m 55 sec
Reputation Power: 3163
Facebook MySpace
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > ActionScript 2 - Get a symbols own coordinates

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap