Skip navigation
Currently Being Moderated

Pass a variable from main class to a MovieClip

Dec 26, 2011 8:25 AM

Hello !

I have a document with main class.

I also have some movieclips which have their own class and functions.

I am trying to pass a variable from my main class to one of these MovieClips.

I tried some stuff, nothing worked.

Who can help ?

 
Replies
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 8:38 AM   in reply to he11f1re

    are the moveiclips instantiated in your document class?  if so, they have access to main class variables.

     

    if the movieclips are added in the ide, they'll have to reference the root cast as a movieclip:  MovieClip(root).mainVar (if the code is on the main timeline)

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 8:56 AM   in reply to he11f1re

    how/where is myMovieClip instantiated?

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 11:30 AM   in reply to he11f1re

    if that movieclip method is public, you can use:

     

    MovieClip(root).yourmovieclipinstancename.DoYourFunction(somestring);

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 12:24 PM   in reply to he11f1re

    you probably have more than 1 error.  respond to each of the following:

     

    1.  are you checking if the main timeline is on frame 4 so your movieclip exists?

     

    2.  is your method public?

     

    3.  show the code you're using to reference that method.

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 1:01 PM   in reply to he11f1re

    Match_Easy looks like a class name.  you need to use the instance name.

     
    |
    Mark as:
  • kglad
    72,261 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 5:54 PM   in reply to he11f1re

    you're welcome.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points