i’m trying to target a function in one class from another. i’m able to call the function using(public static function imagecount()) but i can’t a variable out side of that function. when i do i get this error:
1120: Access of undefined property _imagecount.
so below from call ‘person’ i want to call fucntion ‘imagecount’ in class ‘model’. the call works but when i try and define a variable in class ‘model’ that is incremented in the ‘imagecount’ function i get the above error. any idea how i can do this. it seem that my function has to be of type public static to be accessed from the other class.
///////////////// model class
package com.model
{
import flash.events.*;
import flash.net.*;
import flash.display.*;
public class Model extends EventDispatcher
{
public var _imagecount:int=0;
public function Model(){}
public static function imagecount():void{
_imagecount=_imagecount+1;
//trace("imagecount");
}
}
///////////////// person class
package com.person
{
import flash.display.*;
import flash.events.*;
import com.model.*;
public class Person extends Sprite
{
private function onImageLoad(e:Event):void{
_mediaLoader.removeEventListener(Event.COMPLETE, onImageLoad);
var image:Bitmap = Bitmap(_mediaLoader.getLoadedData());
_imageContainer.addChild(image);
Model.imagecount(); ////here i'm calling the function trying to add to the count number.
}
}