Hello I got a little class and all works fine. Then I add it in Document Class and puff, Error 1034 happens.
Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2be9dba1 to fl.text.TCMText. at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at Wyjazd()
at Wyjazd/wyskok()
My class Code.
package
{
import fl.transitions.Tween;
import fl.motion.easing.*;
import flash.filters.*;
import flash.events.MouseEvent;
import flash.display.Stage;
import flash.display.MovieClip;
public class Wyjazd extends MovieClip
{
public function Wyjazd(ar:Array=null)
{
if (ar!=null)
{
init(ar);
}
}
public function init(ar:Array):void
{
var time:Number = 0.2;
var offset:Number = 0;
var posX:Array = new Array(12);
for (var i:Number = 0; i < ar.length; i++)
{
var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,266.65 + offset,time,true);
ar[i].addEventListener(MouseEvent.CLICK,onClick);
posX[i]=ar[i].x;
time += 0.02;
offset += 15.25;
}
function onClick(e:MouseEvent)
{
time = 0.2;
for (var i:Number = 0; i < ar.length; i++)
{
var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,posX[i],time,true);
time += 0.02;
}
}
}
}
}
And the Frame Code:
import flash.events.MouseEvent;
import fl.transitions.Tween;
import flash.display.MovieClip;
stop();
ofertaBTN.addEventListener(MouseEvent.CLICK, wyskok);
function wyskok(e:MouseEvent)
{
var vektor:Array =new Array (I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII);
var menu:Wyjazd = new Wyjazd(vektor);
}