|
-
Hi there, thanks for the help on this though i'm confused by your comment 'the code below assumes that winNav is in scope. I've had a quick read up on scope but still unfamiliar. To help you understand... code pasted.
Code:
----------
package com.site.microsite{
import flash.display.*;
import flash.events.*;
public class WinathonMC extends MovieClip {
public function WinathonMC() {
var winNav:WinNav = new WinNav();
addChild(winNav);
winNav.x = stage.stageWidth/2;
winNav.y = 575;
winNav.nav3spotlight0.rotation = 50;
winNav.nav3spotlight1.rotation = 120;
winNav.nav3spotlight2.rotation = 60;
winNav.nav3spotlight3.rotation = 140;
//spotlight variables
var spotlightCW0:Boolean = true;
var spotlightCW1:Boolean = true;
var spotlightCW2:Boolean = true;
var spotlightCW3:Boolean = true;
var spotlight00rot:Number = winNav.nav3spotlight0.rotation;
var spotlight01rot:Number = winNav.nav3spotlight1.rotation;
var spotlight02rot:Number = winNav.nav3spotlight2.rotation;
var spotlight03rot:Number = winNav.nav3spotlight3.rotation;
var bulbclips:Array = new Array();
for (var i:uint; i < 58; i++) {
bulbclips.push("winNav.bulb"+i);
var index:int = 0;
trace("winNav.bulb"+i);
}
winNav.addEventListener(MouseEvent.MOUSE_OVER,onNa vOver);
winNav.addEventListener(MouseEvent.MOUSE_OUT,onNav Out);
function onNavOver(evt:MouseEvent) {
addEventListener(Event.ENTER_FRAME,onEnterFrame);
function onEnterFrame() {
// rotation of spotlight 1 on mouse event
if (spotlight00rot > 70) {
spotlightCW0 = false;
}
if (spotlight00rot < 30) {
spotlightCW0 = true;
}
if (spotlightCW0 == true) {
winNav.nav3spotlight0.rotation = (spotlight00rot += .4);
} else {
winNav.nav3spotlight0.rotation = (spotlight00rot -= .4);
}
// rotation of spotlight 2 on mouse event
if (spotlight01rot > 120) {
spotlightCW1 = false;
}
if (spotlight01rot < 70) {
spotlightCW1 = true;
}
if (spotlightCW1 == true) {
winNav.nav3spotlight1.rotation = (spotlight01rot += .6);
} else {
winNav.nav3spotlight1.rotation = (spotlight01rot -= .6);
}
// rotation of spotlight 3 on mouse event
if (spotlight02rot > 120) {
spotlightCW2 = false;
}
if (spotlight02rot < 50) {
spotlightCW2 = true;
}
if (spotlightCW2 == true) {
winNav.nav3spotlight2.rotation = (spotlight02rot += .6);
} else {
winNav.nav3spotlight2.rotation = (spotlight02rot -= .6);
}
// rotation of spotlight 4 on mouse event
if (spotlight03rot > 160) {
spotlightCW3 = false;
}
if (spotlight03rot < 90) {
spotlightCW3 = true;
}
if (spotlightCW3 == true) {
winNav.nav3spotlight3.rotation = (spotlight03rot += .4);
} else {
winNav.nav3spotlight3.rotation = (spotlight03rot -= .4);
}
//winNavigation.bulb20.play()
bulbclips[index].play();
}
}
function onNavOut(evt:MouseEvent) {
addEventListener(Event.ENTER_FRAME,onEnterFrame);
function onEnterFrame() {
//rotation stopped for spotlight 1 on mouse out
if (spotlightCW0 == true) {
winNav.nav3spotlight0.rotation = (spotlight00rot -= .4);
} else {
winNav.nav3spotlight0.rotation = (spotlight00rot += .4);
}
//rotation stopped for spotlight 2 on mouse out
if (spotlightCW1 == true) {
winNav.nav3spotlight1.rotation = (spotlight01rot -= .6);
} else {
winNav.nav3spotlight1.rotation = (spotlight01rot += .6);
}
//rotation stopped for spotlight 3 on mouse out
if (spotlightCW2 == true) {
winNav.nav3spotlight2.rotation = (spotlight02rot -= .6);
} else {
winNav.nav3spotlight2.rotation = (spotlight02rot += .6);
}
//rotation stopped for spotlight 4 on mouse out
if (spotlightCW3 == true) {
winNav.nav3spotlight3.rotation = (spotlight03rot -= .4);
} else {
winNav.nav3spotlight3.rotation = (spotlight03rot += .4);
}
}
}
}
}
}
-----------
Sorry! Lots of it! As you can see nothing has been physically lifted onto the stage, it's all placed with actionscript from my library items. winNav (my main container movieclip) contains other movieclips that i need to target.
Does this help and does your solution still stand?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|