Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-12-2012, 01:01 AM   #1
AmpedNavy
Registered User
 
Join Date: Jul 2011
Posts: 6
Default Problems with using the attachMovie and with code

This loads the movie symbol, and adds 1 to rotation, but it should be constantly adding 1 to rotation, I don't understand why it's not, doesn't the with(obj){} write all the code for the symbol? If so, this code would normally rotate a symbol constantly +1, I don't understand why it's not working...

Code:
onClipEvent(enterFrame)
{
	_root.attachMovie("Dirt", "Dirt1", 1,{_x:_root.creator_1._x, _y:_root.creator_1._y});
	with(_root.Dirt1)
	{
		onEnterFrame()
		{
			_root.Dirt1._rotation += 1;
		}
	}
}

Last edited by AmpedNavy; 05-12-2012 at 01:51 AM.
AmpedNavy is offline   Reply With Quote
Old 05-12-2012, 12:34 PM   #2
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,191
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

Why do you have 2 onEnterFrame's? Why not just utilize the first one and increase the rotation ?

I think the problem is the wrong way of declaring the onEnterFrame function:

ActionScript Code:
onEnterFrame = function()         {             _root.Dirt1._rotation += 1;         }
__________________
I have returned, and am now 18
Prid is offline   Reply With Quote
Old 05-12-2012, 10:28 PM   #3
AmpedNavy
Registered User
 
Join Date: Jul 2011
Posts: 6
Default

Prid, that doesn't work. It will call that function only once, when it should be called many times...
AmpedNavy is offline   Reply With Quote
Old 05-12-2012, 11:28 PM   #4
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,191
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

Code:
onClipEvent(enterFrame)
you already have an enterFrame handler running, why not use it to your avail?

ActionScript Code:
onClipEvent(enterFrame) {     _root.attachMovie("Dirt", "Dirt1", 1,{_x:_root.creator_1._x, _y:_root.creator_1._y});     with(_root.Dirt1)     {         _rotation += 1;     } }
__________________
I have returned, and am now 18
Prid is offline   Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:11 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.