Thursday, 5 September 2013

as3 accessing objects and vars on main timeline from class

as3 accessing objects and vars on main timeline from class

pstrongI am trying to access vars, functions and objects hard coded on the
main timeline from a class./strong The Objects, vars etc... are loaded
when I call a function in the class like this:/p pSome code from main
timeline:/p precodeimport com.beauMoves; var bm = new beauMoves();
bm.thisWorks(); /code/pre pand below is the class. But it is not accessing
the main timeline. In this case I am trying to access a display object
loaded from the lib and place on the timeline. The object is called Beau
as you can see in the code below. /p precode package com { import
flash.display.MovieClip; import com.*; public class beauMoves extends
MovieClip { public function beauMoves() { // constructor code
trace(BeauMoves); } public function thisWorks() { trace(Cool Beans! This
one worked); // THESE TWO LINES BELOW ARE NOT WORKING var main:MovieClip =
MovieClip(this.parent); main.Beau.alpha = .3; } } } /code/pre

No comments:

Post a Comment