-
1. Re: Newbie to Flash - need help with creating a click tag banner
kglad May 23, 2013 10:13 PM (in response to jeffht681)if clickTAG is defined, use:
import flash.events.MouseEvent;
import flash.net.URLRequest;
circle.addEventListener(MouseEvent.CLICK, clickcircle);
function clickcircle (event:MouseEvent):void {
if (clickTAG.substr(0,5) == "http://www.url.com") { //<-this will never be true but it's the correct conversion of the code you showed. you should probably use: if(clickTAG.indexOf("http://www.url.com")>-1){ instead of that substr() method.var myURL:URLRequest = new URLRequest ("http://www.url.com");
navigateToURL (myURL);
}}
-
2. Re: Newbie to Flash - need help with creating a click tag banner
jeffht681 May 24, 2013 2:25 PM (in response to kglad)Hey - thanks for the reply. Ok, I am getting somewhere.
Using this code:
import flash.events.MouseEvent;
import flash.net.URLRequest;
circle.addEventListener(MouseEvent.CLICK, clickcircle);
function clickcircle (event:MouseEvent):void {
if(clickTAG.indexOf("http://www.google.com")>-1){
var myURL:URLRequest = new URLRequest ("http://www.google.com");
navigateToURL (myURL);
}
}
I get an error: 1120: Access of undefined property clickTAG. So I did some research, and among other things, came up with this thread:
http://forums.adobe.com/message/3041856
Even tho it's from '10, I figured the info was still applicable.
I added var clickTAG:String = "TheWebPage.html"; at the top - now the error is gone, but the banner is not a clickable link.
So also based on that thread, I changed:
var myURL:URLRequest = new URLRequest ("http://www.google.com");
to:
var request:URLRequest = new URLRequest(clickTAG);
But now I get an error: 1120: Access of undefined property myURL
Researching that, it seems I need to import flash.net.URLLoaderDataFormat. Absolutely no clue how to do that. Is that the correct approach, or do I need to do something else?
Thanks again!
-
3. Re: Newbie to Flash - need help with creating a click tag banner
kglad May 24, 2013 4:12 PM (in response to jeffht681)that's why i said, assuming clickTAG is defined.
you need to know how to define it. you won't be hard-coding it. you're supposed to follow directions from your client about how to retrieve the value of clickTAG.
my recollection is that you might be retrieving it using flashvars but you should check that.
-
4. Re: Newbie to Flash - need help with creating a click tag banner
jeffht681a May 29, 2013 7:54 PM (in response to kglad)Thanks!
Ok, so apparently, there really isnt much I need to do here, in terms of code and url - like I originally thought.
Again, I have this:
on (release) {
if (clickTAG.substr(0,5) == "http://www.url.com") {
getURL(clickTAG, "_blank");
}
}
And apparently, the webmaster does the rest. Or at least, that's my understanding of it.
Problem is, the banner is not a clickable url, and the cursor does nto change to a hand. The webmaster says
1. I should ensure that the button associated with the ActionScript that contains the clickTAG is on the top-most layer through the timeline, and
2. The button associated with the ActionScript that contains the clickTAG is extended throughout the entire frame and is applied to all existing frames
I am pretty sure all of the above is true - how do I check to make sure of all of this?
p.s. - had a problem accessing my acct, so I created a new one with the added 'a'
-
5. Re: Newbie to Flash - need help with creating a click tag banner
kglad May 29, 2013 9:08 PM (in response to jeffht681a)are you supposed to use as2 or as3 and are you using the correct as version?
-
6. Re: Newbie to Flash - need help with creating a click tag banner
jeffht681a May 30, 2013 8:21 AM (in response to kglad)I am using AS3. The webmaster sent me this:
"Apparently the Flash or ActionScript version in the submitted SWF is not supported".
That is an error he sees, when he uploads the banner to Google dfp.
Should I switch to AS2? I dont see how that would matter; I thought it's the code that matters, not what you tell Flash CW6 to use - no?
Next approrpriate step to take woule be.... ?
-
7. Re: Newbie to Flash - need help with creating a click tag banner
kglad May 30, 2013 11:13 AM (in response to jeffht681a)if you're using as3 and that is not supported, you need to use as2.
-
8. Re: Newbie to Flash - need help with creating a click tag banner
jeffht681 May 31, 2013 7:28 AM (in response to kglad)but, I am getting really confused here.
I just went back to check my .fla project. When I open the AS window, it is telling me that I am in AS 3.0. If I switch it to AS 2.0, the project doesn't switch to 2.0; it remains as 3.0
How do I switch it to 2.0 - isn't the code the same anyway? How is anything going to know that the banner was created in 3.0 or 2.0 if the code is the same?
Secondly, I am getting an error.
Scene 1, Layer 'as', Frame 1, Line 1 1086: Syntax error: expecting semicolon before leftbrace.
Again, that's from this code:
on (release) {
if (clickTAG.substr(0,5) == ""http:") {
getURL(clickTAG, "_blank");
}
}
Ideas?
Thanks again.
-
9. Re: Newbie to Flash - need help with creating a click tag banner
kglad May 31, 2013 8:25 AM (in response to jeffht681)the flash player uses a publish setting to determine which virtual machine to use to interpret your code. if you publish for as3 and have any as2 code (that's not compatible with as3), no code will work. if you publish for as2 and have as3 code (that's not compatibile with as2), no code will work.
click file>publish settings>script combobox>select actionscript 2.0
the code you're showing in message 8, needs to be attached to a movieclip or button (which is a poor way to code). no code should be attached to objects.
you should assign your button or movieclip and instance name and use it in code attached to the timeline that contains your button or movieclip:
yourbutton.onRelease=function(){
if (clickTAG.substr(0,5) == ""http:") {
getURL(clickTAG, "_blank");
}
}
-
10. Re: Newbie to Flash - need help with creating a click tag banner
leily04 Sep 25, 2014 12:49 AM (in response to kglad)Hi!
I'm facing the same issue more and less.
I have Flash CS6 and I'm using Flash 9, as 2.0.
My code is:
MyClickTagButton.addEventListener(
MouseEvent.CLICK,
function():void {
navigateToURL(
new URLRequest( "http://hec.unil.ch/hec/emba/"), "_blank"
);
}
);
This work perfectly when I test the animation in Flash.
However, when I export it, my link does not work. I see the mouse becoming a hand on the banner but the link does not open in Explorer.
Could anyone help please?!


