Change alpha of a movie clip on a seperate button rollover?

  • minnock92
  • Born
  • Born
  • No Avatar
  • Joined: Nov 29, 2009
  • Posts: 2
  • Status: Offline

Post November 29th, 2009, 7:53 am

I am trying to change the alpha of a movieclip when a seperate button is in it's rollever state. My teacher has come up with some sort of actionscript but this doesn't appear to work. I was wondering if anyone could help me?
here is the actionscript i currently have:


function unistart(){ //uniform start
pants_mc._alpha=30;

}
unistart(); // sets movieclip to 30% alpha.
pants_btn.onRollOver=function(){ // when pants_btn is rolled over pants_mc alpha is set to 100%
pants_mc._alpha=100;
}
pants_btn.onRollOut=function(){ //On rollout pants_mc returns to 30% alpha
unistart();
}

can anyone explain why this doesn't work or suggest an alternative? thanks
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 29th, 2009, 7:53 am

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post December 7th, 2009, 8:26 pm

The problem is right here
Code: [ Select ]
pants_btn.onRollOver=function(){ // when pants_btn is rolled over pants_mc alpha is set to 100%
pants_mc._alpha=100;
}
  1. pants_btn.onRollOver=function(){ // when pants_btn is rolled over pants_mc alpha is set to 100%
  2. pants_mc._alpha=100;
  3. }


This assumes that pants_mc lives INSIDE pants_btn while unistart would appear to be looking for the mc as a sibling of the button. So try changing that line to
Code: [ Select ]
this._parent.pants_mc._alpha=100;


basically telling button to look for a mc by going up one level and then looking for a sister item called pants_mc

Otherwise the code looks correct assuming your using the right clip names.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • minnock92
  • Born
  • Born
  • No Avatar
  • Joined: Nov 29, 2009
  • Posts: 2
  • Status: Offline

Post December 8th, 2009, 11:18 am

thanks, its working fine now

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 36 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.