dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Help making a button load a MC

Hybrid View

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    1

    Help making a button load a MC

    Hey, Im creating a game in flash and i want to have it so that the button you click loads a MC from my library. I went into the properties of the MC and checked Export for Actionscripting, gave it an ID name and an instance name.

    Heres the code i placed on the button:

    my_btn.onPress = function() {
    _parent.attachMovie('rainmovie', 'rain', _parent.getNextHighestDepth(), {_x:100, _y:100});
    }

    when i test the movie an error message pops up saying:

    Statement must appear within on handler
    my_btn.onPress = function() {

    please help thanks!

  2. #2
    Junior Member
    Join Date
    Apr 2008
    Location
    Austin
    Posts
    25
    I'm not going to take credit for this, as I just pulled it off of google for ya, but it should help:

    ----------

    Yeah, Flash is just telling you that your code (attached to an MC) must be contained in one of the following clip events :

    onClipEvent (enterFrame) {

    //statement here

    }

    enterFrame can be replaced with, load, Unload, Mouse down, Mouse up, Mouse move, Key down, Key up, Data.
    If you need any help, feel free to email me at bluehippoflash [at] gmail.com or on AIM at BlueHippoFlash

    Or view my new portfolio here!

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