homepage Welcome to WebmasterWorld Guest from 54.205.98.35
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Basic getUrl action in CS3
This is not working like it used to!
Cienwen




msg:3711473
 7:18 pm on Jul 30, 2008 (gmt 0)

For crying out load! I am trying to perform a simple Flash action and it's not working. I have done this a hundred times before but the upgrade is killing me.

I have a little Flash movie. One scene. It's got a bunch of symbols and movie objects in it. I thought I would make top layer, put a big blue box over it, tune the Alpha down to 0, convert it to a symbol and add the following Actionscript:

on(release)
{
getURL("example.html");
}

But no! I get this annoying little message:

"Current Selection cannot have actions applied to it."

I get this even when I set the Actionscripting to 1.0 & 2.0

Does anyone know a simple way to add a link to a small Flash banner using CS3?

Thank you.

 

PokeTech




msg:3711503
 7:44 pm on Jul 30, 2008 (gmt 0)

I think you have to click on the object then go up to the time line add new layer and call it actions (preferred) then add the code there and see if it works.

Cienwen




msg:3712026
 1:31 pm on Jul 31, 2008 (gmt 0)

Great, thank you. That works half way.

It works perfectly in Firefox and Safari. However, in IE and Opera, I get the hand pointer but when I click, it doesn't take me to my page.

What the hay! I need some help.

Anybody?

rocknbil




msg:3712209
 4:36 pm on Jul 31, 2008 (gmt 0)

When you convert the transparent box to a symbol, make sure it's a button symbol, not a movie symbol. Also make sure "Export for Action Script" is checked.

- Select the button and give it an instance name (myButton).

- Select the FIRST FRAME of the timeline, not the button.

- Paste the following:

myButton.onRelease = function() {
getURL("http://www.google.com");
}

If it doesn't work, use a full URL, as above.

You can also apply similar methods to a symbol that is a movie, as opposed to a button.

However, in IE and Opera, ....

This should mean those plugins are too old and don't support AS3. You can look into that, or just re-publish the SWF and set your publish settings to AS 2.0 as this function is compatible with all older versions. This approach won't work if other parts of your Flash use AS 3.0 programming.

Cienwen




msg:3712375
 7:31 pm on Jul 31, 2008 (gmt 0)

Ok. I have take back some of what I said before. It actually dose not work in Firefox and Safari either. It doesn't work in any of them. It only worked before because in an act of desperation, I wrapped the object tag in an <a> tag. Desperate times. Could the object tags be doing something? This is an old page that I am trying to add something too.

Nonetheless, I am also getting these errors when I publish from Flash:

Description:

1119: Access of possibly undefined property onRelease through a reference with static type Class.

Source:

myButton.onRelease = function() {

Description:

1180: Call to a possibly undefined method getURL.

Source:

getURL("http://www.google.com");

What the hay. I used the code you gave me Rocknbil and I saved the symbol as a Button with "Export for Action Script". I left the other boxes unchecked. I then clicked on the first frame and added the code:

myButton.onRelease = function() {
getURL("http://www.google.com");
}

I also checked by browsers and my Flash player and everything is up to date.

What is happening?! :(

P.S. Can anyone recommend a good book for Flash CS3 and Actionscript 3.0?

rocknbil




msg:3712621
 2:38 am on Aug 1, 2008 (gmt 0)

The best book is right there on the help menu in Flash. :-)

Hard to say what is happening. Start with basics:

1. open new file. You should be able to do AS2 or 3.

2. Draw a box on the stage.

3. Select box, select convert to symbol, name it myButton, check Export for ActionScript, make sure the behavior is Button, not movie.

4. With the symbol selected, go to the properties pane and name this instance myButton. It's probably bad practice to name the instance and the symbol the same, but it will work. What's important is that the instance is named myButton.

5. Paste the code above in frame 1 of the movie.

Run the program, you don't even have to save it. There is no way this won't work. :-)

When you figure out why this one works and your live one doesn't, problem solved!

Cienwen




msg:3712982
 1:57 pm on Aug 1, 2008 (gmt 0)

Rocknbil! That was a great idea. I did just what you said. I opened 2 new files. One as an AS2 and one as an AS3. I put a blue box into each one and then followed your instruction to the letter. The funniest thing happened. The AS2 file worked perfectly and the AS3 file would not work (link) at all. The files were exactly the same except one was AS2 and one was AS3.

With that knowledge, I downgraded my movie to a Flash 8 file and it worked. At least I can get something online. I still want to know though why the AS3 is not working for me. I wonder if it has something to do with this.

When I convert the blue box to a symbol in AS3, I get this warning box: "A definition for this class could not be found in the classpath, so one will be automatically generated in the SWF file upon export."

Any ideas?

rocknbil




msg:3713298
 5:34 pm on Aug 1, 2008 (gmt 0)

Well, that's different, and I stand corrected - getURL is deprecated in 3.0 for a more robust set of methods. :-) If you select only the AS3 manual in help for getURL, you will see a section for ActionScript 2.0 migration. It's done a little differently. A modified example from the help files that will work for "myButton:"

function gotoAuthorPage(event:MouseEvent):void
{
var targetURL:URLRequest = new URLRequest("http://google.com/");
navigateToURL(targetURL);
}

myButton.addEventListener(MouseEvent.CLICK, gotoAuthorPage);

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved