Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
onEnterFrame — Gideros Forum

onEnterFrame

NinjadoodleNinjadoodle Member
edited October 2015 in General questions
Hi guys

I've setup a self.lightbulb movie clip inside a scenes init() function

I'm now trying to set its rotation inside onEnterFrame, but nothing is happening ...
function StageRandom02:onEnterFrame()
	self.lightbulb:setRotation(40)
end
If I put the same line - self.lightbulb:setRotation(40) - inside init(), it works fine.

What could I be doing wrong here?

Thank you heaps for any help!

Comments

  • you are just setting rotation to 40 degress every time, if you want to rotate it, you would need to do something like:
    function StageRandom02:onEnterFrame()
    	self.lightbulb:setRotation(self.lightbulb:getRotation()+40)
    end
  • SinisterSoftSinisterSoft Maintainer
    Accepted Answer
    I think he means it isn't event setting the first setRotation.

    @Ninjadoodle Did you remember to actually point the ENTER_FRAME event to the function ?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Hi @ar2rsawseen

    I'm still getting nothing in the onEnterFrame event - no rotation / movement.

    inside init() it works just fine.

    Thanks again, I'm not sure what it could be :(
  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    Oh yeah, thats too, add to your init function
    self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • Oh man! That was it, I assumed that it was automatically added (like the init function).

    Thanks for that!!

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.