Fab Posted July 7, 2010 Share Posted July 7, 2010 Hello there everyone I´ve came across this forum because i have been searching for solutions to my project problem. I´m folowing this tutorial http://www.gotoandlearn.com/play.php?id=103 but my container (which i have given the instance name of con) movieclip doesn´t work,it just stays static instead of responding to my mouse movement. The code i have is this: package { import com.greensock.TweenLite; import com.greensock.TweenMax; import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.events.*; public class Painel extends MovieClip { public function Painel():void { addEventListener(Event.ENTER_FRAME, loop); } private function loop(e:Event):void { var distx:Number = mouseX / 650; var disty:Number = mouseY / 450; TweenLite.to(con, 2, { rotationY:(-70 +(140*distx)), rotationX:(70 -(140*disty)), ease:Expo.easeOut }); } } } Somehow the words "rotation" doesn´t show in blue in my .as but they are blue in the tutorial. I don´t think i´ve missed anything in the code from the tutorial for rotation not showing in blue which i guess that´s the main problem. I don´t have any sort of errors in the code and the ones i had i´ve already solved coming to this website. Thanks fro your help in advance. The deadline to finish this project is near. Link to comment Share on other sites More sharing options...
TronicVolta Posted July 7, 2010 Share Posted July 7, 2010 Are you publishing to Flash Player 10 and using Actionscript 3? Link to comment Share on other sites More sharing options...
Fab Posted July 8, 2010 Author Share Posted July 8, 2010 I´m actually using Flash CS3 which is still using Flash Player 9 From your question i guess i will have to download Flash cs4 at least. Link to comment Share on other sites More sharing options...
GreenSock Posted July 8, 2010 Share Posted July 8, 2010 The problem TronicVolta was trying to diagnose with the question has to do with the fact that you're trying to tween an object's rotationX and rotationY properties but those are [relatively] brand new properties that are only available in Flash Player 10 or later. You cannot publish an swf for Flash Player 9 and expect to use the 3D properties like rotationX/rotationY/rotationZ/z. Link to comment Share on other sites More sharing options...
Fab Posted July 8, 2010 Author Share Posted July 8, 2010 Thanks for the help guys. I had to download a trial of Flash CS5 to put this working. It now works but i´m having a new problem with the project. I´m having the erro #1009. TypeError: Error #1009: Cannot access a property or method of a null object reference at com.greensock::TweenLite/init() at com.greensock::TweenLite/renderTime() at com.greensock.core::SimpleTimeline/renderTime() at com.greensock::TweenLite$/updateAll() This is my code package { import com.greensock.TweenLite; import com.greensock.TweenMax; import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.events.*; public class Painel extends MovieClip { public function Painel():void { setupClips(); addEventListener(Event.ENTER_FRAME, loop); } private function setupClips():void { var len:int = con2.numChildren; for(var i:int=0; i { var mc:MovieClip = MovieClip(con2.getChildAt(i)); mc.buttonMode = true; mc.loc = [mc.x, mc.y]; mc.addEventListener(MouseEvent.ROLL_OVER, onOver); mc.addEventListener(MouseEvent.ROLL_OUT, onOut); mc.addEventListener(MouseEvent.CLICK, onClick); } } private function onOver(e:MouseEvent):void { var mc:MovieClip = MovieClip(e.currentTarget); TweenLite.to(mc.enlarge, 0.2, { alpha:1 }); } private function onOut(e:MouseEvent):void { var mc:MovieClip = MovieClip(e.currentTarget); TweenLite.to(mc, 0.2, { alpha:0 }); } private function onClick(e:MouseEvent):void { } private function loop(e:Event):void { var distx:Number = mouseX / 650; var disty:Number = mouseY / 450; TweenLite.to(con2, 2, { rotationY:(-70 +(140*distx)), rotationX:(70 -(140*disty)), ease:Expo.easeOut }); } } } I have 5 movieclips inside the con2 movieclip and i´ve tried to instance them before but it didn´t work. When i load my SWF i hover the mouse over each MC butflash gives this error and the MC`s disappear from the scene. Can you help? Link to comment Share on other sites More sharing options...
GreenSock Posted July 8, 2010 Share Posted July 8, 2010 That error means you're trying to tween a null object. Try adding a trace() above your tween(s) and find out which target is null and then fix it to make sure you're referencing an actual object. It sounds like this may be the line that's returning a null object: var mc:MovieClip = MovieClip(e.currentTarget); If e.currentTarget isn't actually a MovieClip, casting it as such will return null. Why are you casting it anyway? Link to comment Share on other sites More sharing options...
Fab Posted July 8, 2010 Author Share Posted July 8, 2010 What i was casting was the movie clip enlarge var mc:MovieClip = MovieClip(e.currentTarget); TweenLite.to(mc.enlarge, 0.2, { alpha:0 }); I forgot to put it on stage. It´s ok now but i still want to ask you another thing because i´m still along way out from finishing my project. If you see in my code i´ve made the movieclips rotating when the mouse hovers the stage. I´m following this tutorial http://www.gotoandlearn.com/play.php?id=103 and i want to have the same effect but with the style from this website from bbc: http://www.bbc.co.uk/switch/meta4orce/launch.shtml When i press the movieclip container2 i want it to open the container3 that is on frame 10 but when i do that the container2 stops rotating and just stays static. Here´s the code: package { import com.greensock.TweenLite; import com.greensock.TweenMax; import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.events.*; public class Painel extends MovieClip { private var inFocus:MovieClip; public function Painel():void { setupClips(); addEventListener(Event.ENTER_FRAME, loop); } private function setupClips():void { var len:int = con2.numChildren; for(var i:int=0; i { var mc:MovieClip = MovieClip(con2.getChildAt(i)); mc.buttonMode = true; mc.loc = [mc.x, mc.y]; mc.addEventListener(MouseEvent.ROLL_OVER, onOver); mc.addEventListener(MouseEvent.ROLL_OUT, onOut); mc.addEventListener(MouseEvent.CLICK, onClick); } } private function onOver(e:MouseEvent):void { var mc:MovieClip = MovieClip(e.currentTarget); TweenLite.to(mc.enlarge, 0.2, { alpha:1 }); } private function onOut(e:MouseEvent):void { var mc:MovieClip = MovieClip(e.currentTarget); TweenLite.to(mc.enlarge, 0.2, { alpha:0 }); } private function onClick(e:MouseEvent):void { var mc:MovieClip = MovieClip(e.currentTarget); if(inFocus == null) { gotoAndPlay(10); } } private function loop(e:Event):void { var distx:Number = mouseX / 650; var disty:Number = mouseY / 450; TweenLite.to(con2, 2, { rotationY:(-70 +(140*distx)), rotationX:(70 -(140*disty)), ease:Expo.easeOut }); } } } How can i keep both rotating even on frame 10? After that i want to display videos from the 4 buttons i have inside container3 just like in the BBC website. Can you help me with that? Link to comment Share on other sites More sharing options...
Fab Posted July 10, 2010 Author Share Posted July 10, 2010 Ok the problem displaying the con3 movieclip is solved now. The next task is to display videos when the user presses the links inside the con3 movieclip. These links are movieclips also. How can i make that so that the videos display somewhere on the stage? Link to comment Share on other sites More sharing options...
GreenSock Posted July 11, 2010 Share Posted July 11, 2010 How can i make that so that the videos display somewhere on the stage? This forum is for questions specifically related to GreenSock products like TweenLite, TweenMax, LoaderMax, TransformManager, etc. You might want to post more general questions like this in the forums at kirupa.com or actionscript.org Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now