Highlighted

TypeError: Error #1006: myDCLS is not a function.

Explorer ,
May 07, 2020

Copy link to clipboard

Copied

I'm trying to access function located in DCLS class from my Pieces class.

Pieces:

  public class Piece extends Sprite
   {
      private var image:Bitmap; 
      private var obj:Object;
      private var gap:Number = 30;  
    
      public function Piece()
      {
         super();
      }
      
      public function init($obj:Object) : void
      {
        this.obj = $obj;
        //taking valuse from my DCLS class works fine
	totalPieces = this.obj.horizontalPieces * this.obj.verticalPieces;
	//here I'm getting error #1006
        this.obj.myDCLS(); 
        

myDCLS function located in DCLS class:

	  public function myDCLS(){
		  //var mycount:int = count;
		  //foundPiecesDCLS++;
		  trace("test");
	  }
TOPICS
ActionScript, Code, Error, How to

Views

1.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

TypeError: Error #1006: myDCLS is not a function.

Explorer ,
May 07, 2020

Copy link to clipboard

Copied

I'm trying to access function located in DCLS class from my Pieces class.

Pieces:

  public class Piece extends Sprite
   {
      private var image:Bitmap; 
      private var obj:Object;
      private var gap:Number = 30;  
    
      public function Piece()
      {
         super();
      }
      
      public function init($obj:Object) : void
      {
        this.obj = $obj;
        //taking valuse from my DCLS class works fine
	totalPieces = this.obj.horizontalPieces * this.obj.verticalPieces;
	//here I'm getting error #1006
        this.obj.myDCLS(); 
        

myDCLS function located in DCLS class:

	  public function myDCLS(){
		  //var mycount:int = count;
		  //foundPiecesDCLS++;
		  trace("test");
	  }
TOPICS
ActionScript, Code, Error, How to

Views

1.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 07, 2020 0
Adobe Community Professional ,
May 07, 2020

Copy link to clipboard

Copied

Hi.

 

How are you calling the init method?

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 07, 2020 0
Explorer ,
May 07, 2020

Copy link to clipboard

Copied

I do it like that:

pieceGuid = new Piece();
                  showGuidCon.addChild(pieceGuid);
                  pieceGuid.init({
                     "image":nowbitmap.bitmapData,
                     "i":i,
                     "j":j,
                     "tileObj":piecesArray[i][j],
                     "horizontalPieces":horizontalPieces,
                     "verticalPieces":verticalPieces,
					  "foundPiecesDCLS":foundPiecesDCLS,
                     "crop":{
                        "x":i * pieceWidth,
                        "y":j * pieceHeight,
                        "width":pieceWidth,
                        "height":pieceHeight
                     },
                     "x":i * pieceWidth + i,
                     "y":j * pieceHeight + j,
                     "width":pieceWidth,
                     "height":pieceHeight,
                     "draggable":false
                  });

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 07, 2020 0
Adobe Community Professional ,
May 07, 2020

Copy link to clipboard

Copied

Thanks.

 

You need to pass an instance of the DCLS class to the init method object you're using as an argument. Something like this:

pieceGuid.init({dLCSInstance:yourDLCSInstance});

// ...

this.obj.dLCSInstance.myDCLS();

 

Or if you don't want/need to instantiate the DCLS class, mark the myDCLS method as static. Like this:

public static function myDCLS():void
{
}

 

Then call the myDCLS method like this:

DCLS.myDCLS();

 

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 07, 2020 0
Explorer ,
May 07, 2020

Copy link to clipboard

Copied

Static method does work, but now I'm getting undefined property or method errors (1180 and 1120 messages).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 07, 2020 0
Swyze LATEST
Explorer ,
May 08, 2020

Copy link to clipboard

Copied

When I pass instance to the init method I get: mySwf.swf contains invalid data.
at DCLS()

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 08, 2020 0