Flash Actionscript problem: on Release GetURL not working with movieclip animation

Discussion in 'HTML & Website Design' started by kurtstoll, Dec 22, 2009.

  1. #1
    I am a Noob to Flash and am having problems getting some movieclips to link to different URLs on release. I am able to get them to animate, and I am able to get them to link to an html page in the same folder, but I can’t get both functionalities to work at the same time and it is driving me crazy!! I've tried putting the actionscript in the instance object, in the action layer, and other things and nothing seems to work!?


    Here is the link to the source file: http://www.myfavorites.com/flashtest/header_v8_122209_v2.fla
    I believe that the actionscripting needs to be done in the "baners" movieclip, but it could also be the "Symbol 3" movieclip. I'm not sure and this is where I also need help.


    Here is also a link to the .swf (http://www.myfavorites.com/flashtest/header_v8_122209_v2.swf). See, if you mouse over the first two clips, they animate, but they do not go to the HTML page if you click on them (http://www.myfavorites.com/flashtest/success1.html). The third clip will go to the page success1.html in the same folder if you click on it, but it does not animate on mouse over.


    I'm using Flash CS3 as my editor and I'm using ActionScript 2.0 for the scripting.

    Any help you can provide on this is most appreciated!! I'm normally pretty good at figuring out things on my own, but This problem is driving me crazy!!
     
    kurtstoll, Dec 22, 2009 IP
  2. webtechnologies

    webtechnologies Peon

    Messages:
    370
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Instead of using "OnRelease"

    Use

    this.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }
     
    webtechnologies, Dec 22, 2009 IP
  3. kurtstoll

    kurtstoll Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks webtechnologies. I appreciate the reply.

    When I try to insert that code into the actions for the movieclip instance on the stage I get the following error:
    "Statement must appear within on/onClipEvent handler"

    Here is the complete actionscript code inside the movieclip instance:

    onClipEvent (load) {
    num = 3;
    }
    this.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }

    A little more background... The movieclip is an instance (instance name = "item3") of another animated movieclip called "Symbol 3"

    Again, any help or other thoughts you can provide is much appreciated!
     
    kurtstoll, Dec 23, 2009 IP
  4. webtechnologies

    webtechnologies Peon

    Messages:
    370
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Add The Code I have given You into the beginning of the "Timeline" of the "Symbol 3" Movie clip.
     
    webtechnologies, Dec 23, 2009 IP
  5. kurtstoll

    kurtstoll Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks webtechnologies. That works for one of the instances, but the problem is that I have three instances of the "Symbol 3" movieclip inside of the "Baners" movieclip. The instances are named "item1", "item2" and "item3". If I insert the code you have given me at the beginning of the timeline for each instance of the "Symbol 3" movieclip like so:

    this.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }

    but modify it so that each one points to a different page, it doesn't work right. Here is what I did more explicitly:

    -----------------------------------------------------

    For the "item1" instance of the "Symbol 3' movieclip inside of the "Baners" movieclip, I put the following actionscript into the 1st frame of the timeline for that instance:

    this.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }

    For the "item2" instance of the "Symbol 3' movieclip inside of the "Baners" movieclip, I put the following actionscript into the 1st frame of the timeline for that instance:

    this.onMouseDown = function() {
    this.getURL("success2.html", "_self");
    }

    For the "item3" instance of the "Symbol 3' movieclip inside of the "Baners" movieclip, I put the following actionscript into the 1st frame of the timeline for that instance:

    this.onMouseDown = function() {
    this.getURL("success3.html", "_self");
    }

    -----------------------------------------------------

    The problem is that no matter which clip I click on, they all take me to success3.html, instead of the different pages I specified. Any ideas on how to fix this?

    Thanks again for all of your help!
     
    kurtstoll, Dec 23, 2009 IP
  6. webtechnologies

    webtechnologies Peon

    Messages:
    370
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Try this

    this.item1.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }

    this.item2.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }

    this.item3.onMouseDown = function() {
    this.getURL("success1.html", "_self");
    }


    Let me know if that works,
     
    webtechnologies, Dec 23, 2009 IP
  7. kurtstoll

    kurtstoll Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Actually, what I tried was this, but now when I click on them they don't go anywhere

    this.item1.onMouseDown = function() {
    this.item1.getURL("success1.html", "_self");
    }

    this.item2.onMouseDown = function() {
    this.item2.getURL("success2.html", "_self");
    }

    this.item3.onMouseDown = function() {
    this.item3.getURL("success3.html", "_self");
    }


    Any other ideas or thoughts?
     
    kurtstoll, Dec 23, 2009 IP
  8. webtechnologies

    webtechnologies Peon

    Messages:
    370
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    did You try just this.getURL?
     
    webtechnologies, Dec 23, 2009 IP
  9. kurtstoll

    kurtstoll Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes. No luck. It doesn't link to anything now when I click on each one. So basically using this code they all link to the same page or don't work. I'm guessing here, but I think that by using "this." the actionscript thinks you are referring to the entire "baners" movieclip instead of each of the specific instances (item1, item2, item3) of the "Symbol 3" movieclip within the "baners" movieclip.

    Is there another way to refer to each instance when trying to call getURL ? For some reason, Flash doesn't seem to be recognizing the instance names.
     
    kurtstoll, Dec 23, 2009 IP