Hi, I need help with an AS2 button linking documents and external sites

I am way behind having recently moved from HTML to Flash as2.

I have an issue making a simple linking button and no matter how much I google I cannot find the answer.

Here is what I want to do:

  1. Make a button that links an external site / internal document (I assume the coding is extremely similar)
  2. Place this button either in a nested MC or on the main action page (“Scene 1”)

Here is what I have done:

  1. I used the on(release) coding as well as the my_btn.onRelease = new Function() coding.
  2. I have placed the #1 coding on my button inside of the created component. Did not work.
  3. I placed this coding on the Scene 1 single frame layout on a unique layer.
  4. I placed this coding on the nested MC in a layer.
  5. I placed this coding (f9 to button action panel) on the nested MC component by highlighting it on the screen.
  6. I tried to make a MC component “button”’ and failed miserably.

Potential issues:

  1. I am not properly “digging out” and calling the btn when it is nested or on the nested MC.
  2. My computer is broken?

Here is what works so far:

  1. My button up/over/down/hit stages all seem to function without issue. This, unfortunately, does not open the link at all.

SIDENOTE: I would like to make the link target as “_blank”. I understand that much.

QUESTIONS:

  1. Has anyone encountered similar problems?
  2. Would you like me to post the coding (I literally have no real coding to post, it’s such a small amount of the on(release) or myBTN.onRelease function coding)?
  3. I hope this is as well explained as I could make it. Is there something confusing?

I have a background in Java and C++ and I have figured out HTML fairly functionally. Please help me on Flash (I am using CS4).

AWAITING INTELLIGENT RESPONSE.

You need to select the button on stage, and give it an instance name e.g my_btn
Then your my_btn.onRelease = function(){ /* do stuff */} will work. Deselect the button and place the actionscript in the timeline, making usre that the buton exists on the timeline at the point where the actionscript is.

I will do this, hopefully it works without any issue.

Thanks again!

Basically I just created the instance name of the photo gallery button under ‘properties’.

I placed the coding directly into the MC timeline precisely where the gallery button exists.
photoBTN.onRelease = function(){
getUrl(“www.sitepoint.com”, “_blank”);
};

When I load the HTML or the Flash.swf player file, the button does not perform any of the function action. The button changes states properly but the coding simply does not load the url to a new tab. It doesn’t open a url at all, regardless of target choice.

This is the layout of the site.

AS2 Scene 1 -> contains frame layout for all following MC and content management.

Main Contents -> 5 Keyframe sectors that represent a different site direction link displayed as per the “Scene 1” layout.

There is a “page changer” MC that moves a white grid across the content portion of the page layout and uploads the next called sector (1, 2, 3 or 4 or 5, etc).

I either want to place the photo gallery button as part of the default Scene 1 or as part of the specific Main Contents MC (sector 4). All basic functions of the site work properly, I just need to link some pdf documents and a few external sites.

I am an AS2 flash buffoon and I would greatly appreciate anyone’s help.

Hard to say without seeing your .fla unfortunately, the structure across scenes and frames isn’t clear.

First, thanks for your time.

I have a multilayer opening page that is the default layout for the entire .fla/.swf file. It’s just a simple rectangle of set size that contains a few icons and a centered space defined by alpha lines (this is where the content plays).

At the top of the layout, under the site banner, is just 5 links that are created through a page changer MC navigating a counter loop that “goesToFrame(page)” in the Main Content MC.

On this opening page I could place the icons/links/buttons for the photogallery page I am trying to build. I actually would like to build an external HTML based simple photo gallery with thumbnails, then use the as2 button on this “Scene 1” main layout page.

The Main Content MC has 5 keyframe sections that have different images and text per section (which corresponds to the 5 layout buttonized links).

There is one particular “link” from the layout design that is called LINKS, specifically for PDF documents and uh… that external photogallery HTML page I want to build.

I just want to create a button (or mc link object) to open the PDF’s and the HTML Photo Gallery on a new tab.

I am embarassed to show you the FLA because I am a noob and I downloaded a default template from Flashmo.com and I am not sure if I am a good boy doing so.

  1. I will show you the FLA if u want
  2. I figured I can just put HTML links/iconbuttons outside of the Flash swf parameters (like, under it or at the edges). The <a href> works great in my mind thus far.

Choosing option 2 gives me a problem: On the LINKS page I am still at a loss to linking the PDF documents through as2 coding or any which way I can in Flash.

I don’t know how to thank you for your time for even reading my gibberish, but uh… I guess I can be an active member of the site helping other noobs be less noob.

Sincerely thanks.

BTW this site is for an international school and I am the inhouse coder. Problem is I am HTML proficient but everything else deficient. Hoping you can help. toodles.

Add http:// to the url :wink:

Dear Paul,

HAHAHAHAHAAHAHAHAHAH… I’m such a dunce… The site now links! Thanks!

One more thing?

I’m continue to look up how to do the same for PDF documents that need to be downloaded, would I be able to bother anyone for one more thing?

the getURL is appropriate for PDF document linking? It’s not working currently!

I will continue my googlering in search for the answer… thanks sitepoint guru and advisors.

Signing Off,

Johnnybegood~

Hi,

After loading some more buttons in the same fashion I now have a flashing flash project that flickers forever on initial opening of the .swf. This is in both swf and the html that loads the swf.

I didn’t intentionally change anything, other than adding a few buttons on the text layer then moving them to the photo layer for other purposes. I created instances and loaded some as2 coding for external linking on a new tab and NOW!!!

The friking project strobes like it’s discotime.

I’m not that big of a fan of disco.

please help?

Can you post your fla?

Here’s the fla.

Current Problems: Disco strobe light effect causing temporary ocular seizures… Seriously opposing all earnest intention. Buttons still giving me troubles.

I’ve been working on this for almost 6 months… from html then to as3 then to as2 then to… slow motion dramatic dancing…

Hope there’s someway you can help.

OH SIDENOTE: I attempted to load an embedded as3.swf into this current as2. It was an as3 intro, but that didn’t work, so I loaded this current fla/swf into the other as3 project.

This is the results of attempts to load as3 into the current as2 file (in attachment). There might have been some coding overlaps or bugs in rendering that were latent until I started using the external link call functions.

Seriously please limit the laughing at my silliness… fla’s have feelings too.

ATTACHED! Um…

I tried to attach the FLA file and it says “Invalid Attachment”. This is probably because of the type setting on the upload function for this site, or any parsing that the upload function may perform in order to hash the data and then transfer it. It’s seems to be like the “save as” option that sometimes disallows certain file type saves (like in photoshop). To fix this it would probably require an update in the java or whatever coding environment used to project this .php site. Or a workaround for the current “upload/save as” functions being used.

Ok first off there is no preloader code in scene 1.

In the galliria you have


var prevListener:Object = new Object();
prevListener.onMouseDown = function() {
    gotoAndStop(1);
};
prevBtn.addListener(prevListener);
//and
var nextListen:Object = new Object();
nextListen.onMouseDown = function() {
    gotoAndStop(2);
};
nextBtn.addListener(nextListen);

change these to


prevBtn.onRelease=function(){
    gotoAndStop(1);
}
stop()
//And
nextBtn.onRelease=function(){
    gotoAndStop(2);
}
stop()

Also make sure that your buttons have there respective instance names.

I am thankful. Your involvement in my project helped me clean up some code and now the project has progressed. I have other oddities occuring but that is okay because I can figure it out as of now.

Thank you again Paul.

By the way, I sent you an outdated flash file and that is why there was no preloader code. The odd thing is, the actual file I was suppose to send ALSO doesn’t have preloader code yet there is a “loading…” text showing up center screen to my chagrin…

This is irregardless because I have just cleaned up the code with content using the outdated flash file I sent to you. The strobe disco has ended and I am thankful because I no longer am wearing platforms. I am just stepping and I hope this strange rant is somewhat amusing… it’s the only offering I have to offer and such.

As we say in counter-strike… just dance…

Looking forward to potentially bothering you in the future. Till then, toodles like noodles…

I am glad it is all working as intented for you now. :slight_smile: