Skip to main content
May 3, 2010
Answered

Need some help updating some code to be AS3 compliant...

  • May 3, 2010
  • 2 replies
  • 435 views

rts and programmers in the AS3/Flash community,

First off, thanks in advance for any help and advice you can offer. I am completely out of my depth here...

I am pretty much a novice at Flash. I know enough to get myself into trouble, which is pretty much exactly what I've done. I am the entire design department for a small industrial rentals company, and we have just decided to do a series of online ads. I used Flash MX back 3-4 years ago, and knew enough to make simple movies and add button actions, etc. so I felt comfortable enough to help out by creating these ads.

Well, to my surprise, when I was done the ads, and went to add in some code I was provided per the specifications of the site we're advertising on, it's no longer possible to add actions to objects in AS3.

And, here's where i'm coming to you all for help, I have no idea how to modify this code, which looks like it was written for Flash MX and previous, to be applied to a button, to work in Flash CS4/ ActionScript 3.

Here's the code I was given:

on (release) {

if (clickTAG.substr(0,5) == "http:" || clickTAG.substr(0,6) == "https:") {

getURL(clickTAG, _blank);

}

}

Based on some pretty basic Googling, I learned enough to create a very simply button action to visit a URL, but the site we want to advertise on will not allow us to use this method.

Could I get some help, if at all possible?

Thanks again for any insight

Brandon

This topic has been closed for replies.
Correct answer Ned Murphy

You don't necessarily need to modify the code to make it AS3.  You can just change your Flash Publish Settings to utilize AS2 instead of AS3 and the code you show will be able to be used in the way you are familiar.  AS3 drew a line in the sand and put an end to the (less than desirable) practice of placing code on objects.

2 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
May 3, 2010

You don't necessarily need to modify the code to make it AS3.  You can just change your Flash Publish Settings to utilize AS2 instead of AS3 and the code you show will be able to be used in the way you are familiar.  AS3 drew a line in the sand and put an end to the (less than desirable) practice of placing code on objects.

May 3, 2010

Ned, Thank you so much, I was going nuts trying to figure this out, recoding, visiting umpteen sites, the whole nine yards.

My hat's off to you, and Occam's Razor.

Thanks again!

Ned Murphy
Legend
May 3, 2010

You're welcome

May 3, 2010

I would also like to add that I (apparently) cannot actually add the code to the button object. I am using Adobe CS4.

Why might I not be able to do this? It seems like people elsewhere on the forums are saying that this is possible...

thanks,

Brandon