Hi everyone,
I’m new to Flash AS3, just trying to get my head around it. At the moment I’m trying to figure out packages and how to make a package full of functions.
I wrote a package with a function in it, I want to import this package and be able to use the function in it.
//Align.as
package com.madebyluke.display.align
{
import flash.display.MovieClip;
function alignCenter(target:MovieClip):void
{
target.x = stage.stageWidth/2 - target.width/2;
target.y = stage.stageHeight/2 - target.height/2;
}
}
//Align_exanple.fla
import com.madebyluke.display.align.Align;
alignCenter(box_center);
With that code, I get the following error,
ReferenceError: Error #1065: Variable alignCenter is not defined.
at align_example_fla::MainTimeline/align_example_fla::frame1()
Any idea what I’m doing wrong, the path for the packages is fine, I already have a class working in another example.