Skip to main content
Known Participant
December 31, 2018
Question

how to pass parimiters onto a movieClip through a method function

  • December 31, 2018
  • 2 replies
  • 492 views

I can pass it like example below but I want it like Movieclip.gotoAndPlay(1) or Movieclip.ColorThis(thecolor)  so what ever movieclip I want to add values is outside the function (). 

I don't know if it will ever be useful but I think it looks nicer

ColorThis(mymov,nm5);

function ColorThis(Pmov:MovieClip,mycolor:Number):void {

var newColorTransform_2:ColorTransform = new ColorTransform();

newColorTransform_2.color = mycolor;

Pmov.transform.colorTransform = newColorTransform_2;

}

This topic has been closed for replies.

2 replies

Colin Holgate
Inspiring
January 1, 2019

I think I will mark this as assumed answered, because it wasn't really a question. People can still make comments.

Your original idea seemed good, whether it then is as a class doesn't matter.

kglad
Community Expert
Community Expert
December 31, 2018

create a class for the movieclips that need a custom method and add all the public methods you need.

Known Participant
January 1, 2019

I don't understand classes much past the document class and a movie clip class from the library.  I am using neither here, this is what I got and I get this error

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

the classes folder is in the same folder as the main swf

package  classes{

import flash.display.MovieClip;

public class mytest extends MovieClip  {

public function mytest(Width:Number) {

this.width = Width

}

}

}

main timeline code

import classes.mytest;

mymov.mytest(100)

kglad
Community Expert
Community Expert
January 1, 2019

try:

var mymovie:mytest=new mytest(100);

but it doesn't seem to me that would be very useful.