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

  • minnock92
  • Born
  • Born
  • minnock92
  • Posts: 2

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

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.
  • minnock92
  • Born
  • Born
  • minnock92
  • Posts: 2

Post 3+ Months Ago

thanks, its working fine now

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 5 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.