Hiya folks and actionscript gurus.
I’m running into a problem trying to convert my code to a document class. I’ve read a bunch of tutorials online, and followed their instructions on it, though I keep running into “Error 1120: Access of undefined property stage.” I can’t seem to figure out what I need to do to correct this. Please help!
Here’s my code:
package {
//IMPORT & INITIALIZE CLASSES
import caurina.transitions.*;
import caurina.transitions.properties.FilterShortcuts;
import caurina.transitions.properties.ColorShortcuts;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.filters.GlowFilter;
FilterShortcuts.init();
ColorShortcuts.init();
public class ExpandableGlobeClass extends MovieClip {
//DEFINE VARIABLES
//FILTERS
var red_glow_in:GlowFilter = new GlowFilter(0xCC0D14,1,5,5,2,1,false,false);
var red_glow_out:GlowFilter = new GlowFilter(0xCC0D14,0,0,0,2,1,false,false);
var yellow_glow_in:GlowFilter = new GlowFilter(0xF6EB14,1,5,5,2,1,false,false);
var yellow_glow_out:GlowFilter = new GlowFilter(0xF6EB14,0,0,0,2,1,false,false);
var green_glow_in:GlowFilter = new GlowFilter(0x33CC00,1,5,5,2,1,false,false);
var green_glow_out:GlowFilter = new GlowFilter(0x33CC00,0,0,0,2,1,false,false);
var globe_glow:GlowFilter = new GlowFilter(0xFFFFFF,1,10,10,2,1,false,false);
//MOVIES LOADED FROM LIBRARY
var globe_fade_solid:MovieClip = new globe_fade_solid_mc();
var globe_mask:MovieClip = new globe_mask_mc();
var landmasses:MovieClip = new landmasses_sq_mc;
var legend:MovieClip = new legend_mc();
//PLACE DISPLAY OBJECTS & SET PROPERTIES
stage.scaleMode = StageScaleMode.NO_SCALE;
globe_fade_solid.x = stage.stageWidth - 210;
globe_fade_solid.y = 10;
globe_fade_solid.filters = [globe_glow];
landmasses.x = globe_fade_solid.x - 198;
landmasses.y = globe_fade_solid.y + 5;
landmasses.width = 785;
landmasses.height = 200;
landmasses.mask = globe_mask;
globe_mask.x = globe_fade_solid.x;
globe_mask.y = globe_fade_solid.y;
legend.x = stage.stageWidth - (stage.stageWidth - globe_fade_solid.x);
legend.y = (globe_fade_solid.y + globe_fade_solid.height) + 20;
legend.scaleX = 3;
legend.scaleY = 3;
stage.addChildAt(globe_fade_solid,0);
stage.addChildAt(landmasses,1);
stage.addChildAt(globe_mask,2);
stage.addChildAt(legend,3);
//DEFINE FUNCTIONS
function spin_right():void {
Tweener.addTween(landmasses, {x:globe_fade_solid.x + 198, time:10, transition:"linear", onComplete:reset_land_left});
}
function reset_land_left():void {
landmasses.x = globe_fade_solid.x - 192;
spin_right();
}
function red_glow(event:MouseEvent):void {
Tweener.addTween(landmasses.red_co_double, {_filter:red_glow_in, time:1, _color:0xff0000});
Tweener.addTween(legend.not_free_txt, {_filter:red_glow_in, time:1, _color:0xff0000});
}
function red_glow_stop(event:MouseEvent):void {
Tweener.addTween(landmasses.red_co_double, {_filter:red_glow_out, time:1, _color:null});
Tweener.addTween(legend.not_free_txt, {_filter:red_glow_out, time:1, _color:null});
}
function yellow_glow(event:MouseEvent):void {
Tweener.addTween(landmasses.yellow_co_double, {_filter:yellow_glow_in, time:1, _color:0xffff00});
Tweener.addTween(legend.part_free_txt, {_filter:yellow_glow_in, time:1, _color:0xffff00});
}
function yellow_glow_stop(event:MouseEvent):void {
Tweener.addTween(landmasses.yellow_co_double, {_filter:yellow_glow_out, time:1, _color:null});
Tweener.addTween(legend.part_free_txt, {_filter:yellow_glow_out, time:1, _color:null});
}
function green_glow(event:MouseEvent):void {
Tweener.addTween(landmasses.green_co_double, {_filter:green_glow_in, time:1, _color:0x00ff00});
Tweener.addTween(legend.free_txt, {_filter:green_glow_in, time:1, _color:0x00ff00});
}
function green_glow_stop(event:MouseEvent):void {
Tweener.addTween(landmasses.green_co_double, {_filter:green_glow_out, time:1, _color:null});
Tweener.addTween(legend.free_txt, {_filter:green_glow_out, time:1, _color:null});
}
//GLOBAL ACTIONS
spin_right();
//RED COUNTRY ACTIONS
legend.not_free_txt.addEventListener(MouseEvent.MOUSE_OVER, red_glow);
legend.not_free_txt.addEventListener(MouseEvent.MOUSE_OUT, red_glow_stop);
//YELLOW COUNTRY ACTIONS
legend.part_free_txt.addEventListener(MouseEvent.MOUSE_OVER, yellow_glow);
legend.part_free_txt.addEventListener(MouseEvent.MOUSE_OUT, yellow_glow_stop);
//GREEN COUNTRY ACTIONS
legend.free_txt.addEventListener(MouseEvent.MOUSE_OVER, green_glow);
legend.free_txt.addEventListener(MouseEvent.MOUSE_OUT, green_glow_stop);
}
}
Thanks a bunch.