Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums Modifing variable values of another movieclip
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 12-05-2008, 10:04 PM #1 super8mm Registered User   Join Date: Dec 2008 Posts: 2 Modifing variable values of another movieclip I have 3 movieclips on the stage The movieclip "brain" is where I put all the variable calculations. The movieclip "earth" moves on a simple tween the third movieclip "moon" is nested in the movieclip "earth" moving in its tween. In the timeline of movieclip "earth" I put this on frame 1: var pnt:Object = {x:moon._x, y:moon._y} moon.localToGlobal(pnt); Trace( pnt.x); Trace( pnt.y); Frame 2 is gotoAndPlay (1) This works great! [correction edit] It doesn't work great, it returns the wrong coordinates. It actually gives the distance to twice as far from center point of the movieclip "earth" So to get the right coordinates I made this calculation adjustment removing half the distance: _x=pnt.x + ( (xx-pnt.x) /2 ); _y=pnt.y + ( (yy-pnt.y) /2 ); xx and yy are the center coordinates of the movieclip "earth" by putting a dummy movieclip at the 0,0 location. var pnt:Object = {x:dummy._x, y:dummy._y} dummy.localToGlobal(pnt); xx=pnt.x; yy=pnt.y; Question: How do I send the values pnt.x and pnt.y to the clip "brain" ? It would be great if I could do that differently than how I'm doing it now. For now I use an invisible movieclip named "pin01" It is used as the clip both can read and affect as the movieclip "moon" is not visible to the movieclip "brain" I replace: Trace( pnt.x); Trace( pnt.y); and place instead: with (_root.pin01) { _x=pnt.x; _y=pnt.y; } in the movieclip "brain": with (_root.pin01) { xxx=_x; yyy=_y: } trace ("moon x=" + xxx + " moon y=" + yyy); I get what I want but there must be a better way? Last edited by super8mm; 12-06-2008 at 03:23 AM.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

 Similar Threads Thread Thread Starter Forum Replies Last Post dvalle ActionScript 3.0 2 08-07-2008 10:32 PM Superbird77 ActionScript 2.0 2 07-11-2006 03:05 PM Digression ActionScript 2.0 11 07-10-2006 01:21 PM delhan ActionScript 1.0 (and below) 4 12-07-2004 07:33 PM CyanBlue ActionScript 1.0 (and below) 3 03-20-2002 08:42 AM

All times are GMT. The time now is 06:50 AM.

///