A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: refer a class from a nested movieclip

  1. #1
    Member
    Join Date
    Oct 2000
    Posts
    43

    refer a class from a nested movieclip

    I have the class avanzada.as:


    package
    {

    import flash.display.MovieClip;

    import pek.difuminar;

    public class avanzada extends MovieClip

    {

    }

    }


    I use it as document class and basically imports other classes.


    I have the class difuminar.as:


    package pek{

    import flash.display.MovieClip;

    import flash.filters.BitmapFilter;

    import flash.filters.BitmapFilterQuality;

    import flash.filters.BlurFilter;

    public class difuminar extends MovieClip
    {

    public function difuminar(destino)
    {

    var blur:BlurFilter = new BlurFilter();

    blur.blurX = 25;

    blur.blurY = 25;

    blur.quality = BitmapFilterQuality.LOW;

    destino.filters = [blur];

    }

    }

    }



    "difuminar.as" blurs a movieclip.


    I use apply this class to a movieclip in the main time line with this code:

    new difuminar(cuadrox);


    "cuadrox" is the name of the movieclip.

    It works.

    I want to use this class inside a nested movieclip.

    I have a movieclip called:

    box

    Inside this movieclip I have another movieclip called:

    gift


    How can I use the class "difuminar" to modify "gift" movieclip from box movieclip timeline.


    1.

    In "box" movieclip timeline I used this code:

    new MovieClip(root).difuminar(gift);

    but it fails.

    Appears this error message:

    "1137: Incorrect number of arguments. Expected no more than 0."


    2.

    In "box" movieclip timeline I used this code:

    new MovieClip(this.root).difuminar(gift);

    but it fails.

    Appears this error message:

    "1137: Incorrect number of arguments. Expected no more than 0."



    3.

    In "box" movieclip timeline I used this code:

    new difuminar(gift);

    but it fails.

    Appears error this error message:

    "1180: Call to a possibly undefined method difuminar."



    4.

    In "box" movieclip timeline I used this code:


    import pek.difuminar;

    new difuminar(gift);


    And it works!

    but, it is mandatory to add import pek.difuminar?

    or I am doing something wrong?


    I attach the files.

    Thank you in advance
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center