actionscript 3 - Flash AS3 Drawing a line between two objects with different parents -


so have 2 objects different parents , want draw line between them, how do this? know need use localtoglobal not sure how make work this. need x , y coordinates of both objects relative 1 of them, how x , y coordinates of on object relative when have different parents? thanks.

conceptually need (draw dashes, solid line)

parent |      \ child1--child2 

[some code (typed not tested)]

var start:point = parent.globaltolocal(child1.localtoglobal(new point())); var end:point = parent.globaltolocal(child2.localtoglobal(new point())); parent.graphics.linestyle(1); parent.graphics.moveto(child1.x,child1.y); parent.graphics.lineto(child2.x,child2.y); 

[another option]

var start:point = child1.getrect(parent).topleft; var end:point = child2.getrect(parent).topleft; parent.graphics.linestyle(1); parent.graphics.moveto(child1.x,child1.y); parent.graphics.lineto(child2.x,child2.y); 

http://help.adobe.com/en_us/as2lcr/flash_10.0/help.html?content=00001308.html http://help.adobe.com/en_us/as2lcr/flash_10.0/help.html?content=00001320.html

http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/flash/display/displayobject.html#localtoglobal() http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/flash/display/displayobject.html#globaltolocal()

http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/flash/display/displayobject.html#getrect()


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -