Simple button link

I'm trying not to cry. I feel like I've been totally
blindsided by ActionScript 3.0. All I want to do is add a freakin
link to a website on a button.
I can't find any simple tutorials. Please will someone help
me? Either with a sample code snippit or a resource?
Here is what I HAVE found, but it does not work:
btn.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent): void{
navigateToURL(new URLRequest(
http://www.adobe.com/));
I have named the mc on my stage "btn". I get the following
two errors:
'{' expected
and
Unexpected '}' encountered
I'll send happy thoughts your way for any help....
btw, I removed the quotes around the URL because it was
displaying badly in this message.

Okay. As for the book, I bought the O'Reilly AS 3.0 Cookbook
which is pretty good. There is a new O'Reilly book by Colin Moock
coming out June 15th by O'Reilly: Essential AS 3.0. I have ordered
the latter. I'd recommend them both if you can handle books that
aren't dumbed down too much....
Yes, try was supposed to be there :)
Two questions:
1. Did you choose AS 3.0 document for this document when you
made it?
2. Your publish settings (in Flash tab) set to AS 3.0?
I believe it is compiling it as AS 2.0 or something rather
than 3.0, maybe? Because that code I gave you works just fine for
me....

Similar Messages

  • Simple Button

    I have a Dynamic page that is a parts list in a MySQL
    database that I show on a page using PHP in Dreamweaver.
    The page uses a repeat region to list the parts depending on
    what nav link is clicked and what I want to do is add a flash
    button to the repeated region that when clicked will take you to a
    larger view. I have all of this setup and working fine except for
    the flash button.
    For instance when the page is loaded you may see 10 parts
    listed and the button will show up 10 times also, on button next to
    each part listed. I am currently using a simple image as a link to
    the larger view and it works fine. The link looks like this.
    largeview.php?SearchField=<?php echo
    $row_Recordset1['Part']; ?>
    My problem is that flash doesn't read the php in this code:
    "<?php echo $row_Recordset1['Part']; ?>". I need flash read
    the php code so it knows what part number to show.
    Is there any other code that can be used to have Flash read
    the php code?
    I hope I explained this properly and any help would be
    greatly appreciated!
    Mark this message as the answer.
    Print this message
    Report this to a Moderator
    Nickels55
    User is offline
    View Profile
    Senior Member Posts: 2048
    Joined: 01/11/2006
    Send Private Message
    08/16/2007 07:41:46 PM
    Reply | Quote | Top | Bottom
    Tutorial on the subject:
    http://www.kirupa.com/developer/actionscript/flash_php_mysql.htm
    ~Flashtard - Giver of poor advice~
    Mark this message as the answer.
    Print this message
    Report this to a Moderator
    painlessbart225
    User is online
    Junior Member Posts: 3
    Joined: 08/16/2007
    Send Private Message
    08/16/2007 09:28:43 PM
    Reply | Quote | Top | Bottom | Edit
    I guess I don't understand this very well I can't seem to get
    it to work.
    I can get the part # to show on the page using:
    print "myVar=$x";
    but the button link I am trying to use is:
    largeview.php?SearchField="myVar=$x"
    I know this isn't right but the button is just a button using
    the option in Dreamweaver to Insert > Media > Flash Button
    and the only option is a link.
    how should I write the link so that the flash button will
    read it?

    I fixed my own problem.... here's for anyone else with a similar situation or for future people searching the forums
    just use
    setLayout(null); This is not the recommended solution. Try resizing your frame. Does the position of you button remain centered relative to the frame?
    You should be using a LayoutManager as was suggested above. You should read the tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers. I would probably use something like:
    JPanel south = new JPanel( new FlowLayout( FlowLayout.CENTER ) );
    panel.add( button );
    contentPane.add( panel, BorderLayout.SOUTH);

  • Simple button not functioning?

    I've been staring at this code for an hour. Maybe I need a break? This is a very simple button that just won't accept my touch events.
    I have a movie clip. It's instance name is "boardA." The name of the symbol is "letterA" and it is linked to a class file called "Letters" (which is properly linked, I checked).
    This is the code in the class file:
    public function Letters() {
                this.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter);
                trace (this.letter);
            public function createLetter(e:TouchEvent): void {
                trace ("You clicked it!");
                trace ("eName = " + e.target.letter);
    Yet nothing happens when I click the button. The constructor for the file never executes.
    I even moved the touch event to the main frame "boardA.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter)" and it still didn't work. Nothing when I touch the button.
    What am I missing here?
    Thanks
    Amber

    No. Letters.as is in com/freerangeeggheads/spellmaster. It's linked as such - here is the text.
    The base class is: com.freerangeeggheads.spellwhiz.Letters
    The class is: letterA
    When I click the green check box it tell me it can find the class, and when I click the edit class button it takes me to the proper script file.
    I also have the file imported into my main frame.
    This is the Letters.as file:
    package  com.freerangeeggheads.spellwhiz {
        import flash.display.*;
        import flash.events.*;
        import com.freerangeeggheads.spellwhiz.*;
        public class Letters extends MovieClip {
            public var letter:String = "";
            public function Letters(): void {
                this.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter);
                trace (this.letter);
            public function createLetter(e:TouchEvent): void {
                trace ("You clicked it!");
                trace ("eName = " + e.target.letter);
    Thanks!

  • Can there be buttons/links on or in flash object?

    Hi, I have no idea how to ask this question properly. I am only designing this, not making it, so simple answers for me would be good, but also technical answers that I can pass on to the flash person.
    On my home page, I am going to have 3 images that switch out, each that need to have a "learn more >" link and a 1, 2, 3, and pause buttons.
    My question is whether or not these image buttons/links can be placed on or embedded in the flash object. I read this is not possible and that buttons or links have to be separate from flash. Ideally if I wanted to place a "go" button on top of my flash image, that would be great.
    However I have been told the only option is to make one side of this in photoshop where I have the buttons and then place that next to the flash image. My example of this would be the msn.com home page.
    If further descriptions are needed I can post an example.

    Your image hasn't loaded yet, so I'll describe what you should do.  Chances are you will only need one set of buttons to manage everything rather than creating a set for each image.
    If you want to convert each of these items into usable buttons, then select one of them, being sure that all its pieces are selected, then right click on it and select Convert to Symbol ( select it and in the toolbar choose Modify -> Convert to Symbol).
    In the interface that appears, select Button (you could also select MovieClip, but for now, select Button) and give it a name that relates to its functionality in some way, just so it is recognizable by its name in the library.  Click OK.
    Do that for all of the items you want to turn into buttons.  To make things easier to manage, you should place the buttons on their own layer in the timeline.
    If you are handing this over to someone who knows Flash, they should be able to deal with coding the buttons to function the way you want.

  • Can't get Simple button to Load Movie Clip

    Hi I've looked around for the answer to my question on this
    forum
    but havent found it so here it goes. I am working on this
    company's
    Flash site that was built by an outside studio. I am using
    CS3.
    The url to the site is
    http://www.bubbakeg.com.
    (this link will take you to the main page click the shadow
    graphic
    on the left under Bubba and this will take you to the site I
    am speaking
    of. The site is basically 5 different pages or movie clip.
    What I am
    trying to do is basically change the "Spring Break" middle
    graphic
    (which is a Movie Clip) on the HOME page and add a simple
    button
    that will direct the user to a new page. When I replaced the
    graphic
    with a new Movie clip there was no problem but I have added
    a
    button to load a new page (movie clip) and nothing happens.
    This
    button is in the movie clip of the new graphic which is
    called up
    when the page loads. If i take this button and just put it
    on the
    Main Stage in Scene 1 by itself it works and loads the page
    (movie clip). It does not however when it is embeded in the
    Movie
    Clip. The Flash site is basically 5 different Movie Clips
    loaded into
    an "Empty Clip". This empty clip has a timeline with each of
    the
    clips labeled and with their respective sized placeholders.
    And
    when you click on either the links on the Nav bar or the
    graphic
    for each page it loads that movie clip on the main page. It
    seems
    like the button only wants to work on the main timeline. I
    have
    even replaced the code for the "Contact" button with the code
    for the new button and it worked (opening new page). Here is
    the
    code for the new button that does not work:
    on (release) {
    _root.contentHolder.myHeight = 307;
    _root.contentHolder.newLoc = 9;
    heightAnimation();
    I know the location and height from the above code are
    referring to the placement and sizing of each movie clip
    in the "Empty Clip". As i said before this heightAnimation
    and the resizing of the new clip works fine when the
    button resides in Scene 1 on the Main Timeline but not
    within the new movie clip (graphic Ive created.)
    I will upload the main chunk of the code that resides
    in Scene 1 on the first frame of the "Actions" layer.
    If anyone has any ideas I would appreciate it very much!
    Please let me know if I can provide anymore info.
    Thanks!
    Greg

    change:
    function newLayerBT_CLICK(MouseEvent):void{
    to:
    function newLayerBT_CLICK(e:MouseEvent):void{

  • Flash button - linking to HTML page - weird problem

    There could be a really easy solution for this, but I can't
    figure it out. I have a simple button that links to an anchor
    within an HTML page. Here the actionscript for the button:
    on (release) {
    getURL ("test.html#two");
    when the button is pressed, the HTML page comes up but only
    to the top of test.html. The '#two' is not passed to the URL .
    Seems like everything after '#' is ignored. How can I get around
    this?

    hi
    on(press)
    getURL("path of html page");
    }

  • Button Link Transitions with Audio?

    Ive got a question on what can be used as a Button Transition. I have a 10 sec. AV in PP2, that I want to use. In general, no problems. Ive Exported the Video to DV-AVI (silent), and it works beautifully. I only have to do a blend from the Menu for the head and then a still from the Timeline at the tail. No biggie. What I am having problems with is getting an SFX Audio file into the PP2 Sequence for this Transition. So far, I am having problems. I tried to make a Timeline for this AVI with an AC3 Audio, but Encore2 would not allow a link to it, via the Pickwhip. I tried to Import several variations of muxed files, but kept getting errors with the number of channels on Import. Then, I did a muxed MPEG file, and got my first big "Crash" of Encore2. When I linked to the M2v, I got something about Abbie Normal Condition. Wasnt he the founder of the Yippies back in the 60s, along with poet, Allen Ginsberg? The error (really An Abnormal Condition... Please try to Save... ) came up and I could not even exit from Encore2. Had to finally use TaskManager to kill the Process. This was a first for me after all of these years. Lesson - do not use the M2v as a Button Transition!
    Now, Im certain that there are possibilities that I have not tried, but before I beat what could be a dead horse, I wanted to find out one thing: can I even have Audio in a Button Transition?
    I have total control over my Asset, so I can engage in any workaround necessary. If anyone has any info (Help/Manual do not go deeply into specifics on Button Transitions, and even Jeffs Book, Focal Easy Guide... doesnt mention them, as I can find.), Id greatly appreciate it. Same for any ideas on using Audio for these. In my case, its a bit of an electronic whoosh with a long gong tone, and moves left to right and rear to front to rear (in the 5.1 version). I do not need to do 5.1, as stereo, panned left to right would work fine too.
    Appreciate the direction, thoughts and ideas,
    Hunt

    Jbowden,
    Thanks for the simple little test. I just linked my existing SFX AC3 to the Main Menu's Audio and it worked fine. The pan/fade of the 5.1 was intact and worked in Preview.
    I Exported the Button Transition test as a DV-AVI/PCM WAV from PP2, and Imported as a Timeline into Encore2. Tested and it played fine, but there was just the left-right pan, as expected. Linked my Button #1 to the AVI, as it would not link to the Timeline (as before), and went to Preview - "An Abnormal Condition... Save... " happened again. It is obviously not just the M2v, but the AVI, as well.
    Back to square one in my tests. I've been working with a preliminary, test Project in Encore. It was used to create a DVD set for client review of most other aspects of the Project. It contained 4 Dynamic Links to AE, which were rendered out, plus 2 Menus a short lead-in AVI and some other Assets. Without any Button Transitions, it previewed and burned perfectly.
    What I am going to do now is create a fresh Encore2 Project. Initially, it will only have the Play First AVI, the two Menus (Main & Scene Selection) and then I'll work with just the Button Transitions - all other Assets will not be included. I want to eliminate any other possible problem from the mix.
    One thing that occurred to me was that this Project was a very full DVD. Though the Transcode is Automatic, I wonder if I am now adding too much to an already Transcoded Project. Rather than clear all Caches, and Revert to the unTranscoded state in this Project, I'll build, instead, from scratch. If that works, I'll just do the Button Transitions for the Scene Select Menu (4 Buttons/Links) and test again. If it still goes well, I'll add in the Rendered AE files and probably not use DL this time. Then, I'll Transcode and test to see if it all holds up. This method will not tell us exactly where the problem lies, if it works at all, but then when I have time, I can go back and clean Caches and Revert the Assets for a final test.
    To date, the motion-only Button Transitions worked fine. It was only when I have tried (several different schemes) to add Audio, that I have encountered the problem.
    Should have the preliminary test this AM, as the Project is very simple and starting over is not a big deal.
    One side observation that I have made is that after I had to use TaskManager to end the Encore2 Process the other day, it now takes Encore2 a few minutes to even get the Splash Screen up. This is new behavior. I also cannot shift focus to/from Encore2 (with PP2 open), by clicking on the icon in the Taskbar. Even Rt-clicking and choosing Restore does not Maximize it. Only by going to TaskManager and clicking on the Application does it Maximize. As this was my first Encore2 "Crash," I am not sure what might be happening there. If I can get this Project done, I'll probably do a Repair Installation of Encore2, to see if the new behavior subsides.
    Thanks for the input. Will be back with followups.
    Hunt

  • Another Simple Button

    I have a Dynamic page that is a parts list in a MySQL
    database that I show on a page using PHP in Dreamweaver.
    The page uses a repeat region to list the parts depending on
    what nav link is clicked and what I want to do is add a flash
    button to the repeated region that when clicked will take you to a
    larger view. I have all of this setup and working fine except for
    the flash button.
    For instance when the page is loaded you may see 10 parts
    listed and the button will show up 10 times also, on button next to
    each part listed. I am currently using a simple image as a link to
    the larger view and it works fine. The link looks like this.
    largeview.php?SearchField=<?php echo
    $row_Recordset1['Part']; ?>
    My problem is that flash doesn't read the php in this code:
    "<?php echo $row_Recordset1['Part']; ?>". I need flash read
    the php code so it knows what part number to show.
    Is there any other code that can be used to have Flash read
    the php code?
    I hope I explained this properly and any help would be
    greatly appreciated!

    I guess I don't understand this very well I can't seem to get
    it to work.
    I can get the part # to show on the page using:
    print "myVar=$x";
    but the button link I am trying to use is:
    largeview.php?SearchField="myVar=$x"
    I know this isn't right but the button is just a button using
    the option in Dreamweaver to Insert > Media > Flash Button
    and the only option is a link.
    how should I right the link so that the flash button will
    read it?

  • Dreamweaver simpleviewer multiple galleries button links help

    I am trying to do this:
    http://www.airtightinteractive.com/simpleviewer/examples/multiple_galleries/gallery1/index .html
    and here is another good example
    http://www.designhousestudios.co.uk/sampleportfoliogallery/sampleportfolio.html
    on my page here:
    http://peachtree-designs.com/
    This seems to be the code that pertains to the different slideshows (this is from the example webpage of how I want it to be):
    <div id="header" >
    <a href = "../gallery1/index.html">Gallery 1</a> | <a href = "../gallery2/index.html">Gallery 2</a>
    </div>
    <div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
    <script type="text/javascript">
    The "Simple" Viewer slideshow gives instructions on how to simply embed  and I have done that successfully, a link is here in case you want to check it out:
    http://www.airtightinteractive.com/simpleviewer/examples/embedded/
    I have this working fine but would like to embed several galleries. The instruction page of "simple"viewer says to create multiple galleries you just need to:
    " ...To create multiple SimpleViewer galleries, make a copy of the whole SimpleViewer gallery folder for each gallery. Create your individual galleries as normal. You can now create a menu page that links to the index.html page in each sub-folder. Here is an example that contains a menu to navigate between 2 SimpleViewer galleries."
    My confusion lies in what the heck a menu page is. I have ignored this all together and tried looking at the code from pages that give examples. especially the page that gives a download of html.
    But I don't understand how to link the buttons in Dreamweaver to create different slideshows. I've put the four slideshow folders (print, illustration, logo, design) into my main HTML page. I assume the solution is to put the code mentioned above in for each slideshow/gallery .. reference each gallery by my folders names but then somehow make the DW buttons link to those folders.
    I'll keep poking around at this and see if I can figure it out, but any input, advice or help would be SO very appreciated. If you would speak in laymans terms I'd appreciate it, I know flash well but am new to dreamweaver and not very good at codeing though I manage.
    Thanks so much in advance, sorry this is so long winded.
    sharon

    I'm actually still having a problem with the individual galleries linking to the swf. Here's an explination and I'm attaching a snapshot of the file folder structure and the html's:
    Thanks for responding :) I feel like I'm almost there, been struggling with this for a week.
    my site is here:
    http://peachtree-designs.com/web.html
    I am going with a different approach, instead of trying to link the graphics from within each gallery folder I am instead placing each gallery html outside the individual gallery folders in my root folder ... then trying to link the main html page to each html gallery file, and have each gallery file link/see the swf galleries within the folders.
    I have made separate gallery folders for each gallery, print, logo ect is in it's separate folder in the root folder of my website.
    In the main root folder I have the index.html *plus* I've put each galleries html file *outside* it's folder but directly in the root folder, so the main html webpage file can link (with the buttons) to each gallery html in the root folder.
    Problem is getting the galleries html's to connect/link to the swf gallery in each gallery folder (within the root folder) (I'd put the html's directly in it's gallery folder but then the graphics links break). "gallery not found" is what I get and I'm not sure how to do this. In the code of each gallery html is this:
      <td valign="top"><script type="text/javascript">
    var fo = new SWFObject("illustrations/viewer.swf", "viewer", "500", "500", "8", "#c5bdb2");
    fo.write("flashcontent");    
        </script></td>
    so the gallery html's in the root folder *should* be directed to each swf in it's gallery folder: illustrations/viewer.swf .. print/viewer.swf ... etc ... but it's not working.
    I'm going to try to just attach my whole site in case someone can take a look and tell me what's wrong. It's large but I'm desperate and it's hard to explain.

  • CS4- simple button Frustration?

    Hello, I just upgraded to CS4 and am finding Flash very frustrating. I only use flash for very simple ad banners. Usually have one button to click to go to a web page. Now in CS4 professional I can't do the simple of things, like create a link on a button. In the action script panel it says "Current selection cannot have actions applied to it", and the object is simply a button.
    What am I missing here? Thanks for any direction.
    sm

    If all you are doing is simple things like that, switch the publish settings to Actionscript 2.
    Actionscript 3 is a new beast of a language that doesn't necessarily lend itself well to using just a simple button action.
    If you want to use AS3, then give the button an instance name (in the properties panel when you have the object selected) and put the following code in the first keyframe.
    myButton.addEventListener(MouseEvent.CLICK,doClick);
    function doClick(evt:MouseEvent):void {
         navigateToURL(new URLRequest("http://path/to/site"));
    Replacing "myButton" with the instance name you gave your button, and the URLRequest with the web address you want to go to.

  • TS3276 An email sent from my iMac has a button linked to a clip hosted on Vimeo. When received, the link functions on iMac and iPad, but opens a window of app icons on iPhone and iPod touch. Any ideas what's wrong?

    An email sent from my iMac has a button linked to a clip hosted on Vimeo. When received, the link functions on iMac and iPad, but opens a window of app icons on iPhone and iPod touch. Any ideas what's wrong?

    For anyone else reading this thread, it is worth knowing that sometimes an email is, or can be, corrupted thereby jamming the works. The solution above is good, but I just wanted to suggest another one.
    If the problem arises, go to an online mail access service, such as Mail2Web.com and login to you mail account there and delete the offending message.
    Problem solved.
    And George, as this is all entirely voluntary, whinging about no takers may not endear people to you. Besides which, a few minutes of searching on Google would have found you a number of solutions.

  • Why text and button links on a PDF do not work in the iPad

    I have Acrobat Pro 9.2.3 and InDesign CS5.
    I've tried creating both button and text links directly from InDesign (Window > Interactive > Hyperlinks). I then export the multi-page PDF with "Acrobat 6 and Above" selected as well as the "Hyperlinks" and "Interactive Elements" checked. When I open the PDF in my iPad, none of the text or button links work.
    Then . . .
    I tried opening the same multi-page PDF in Acrobat Pro, and manually created the link boxes (Tools > Advanced Editing > Link Tool). The iPad still can't interprete these two interactive elements.
    Any clues what I'm doing wrong?

    Try exporting as ePub - now test inside Digital Editions and if OK - drag the file into iTunes and synch to iPhone/iPad.
    It's probably a Preview issue as mentioned but exporting to ePub is good fun!
    J.

  • Button Link to Object Standard.

    Dear All.,
    Now I have a problem with button link to object stanbard (17 is Sale order object).
    I have to use button link and Editbox on the new form, then I set button link to this editbox and set LinkedObject=17 in screen painter. I have run this form i select Sale Order document Number on this Editbox and i click button link to sale order that show data following my selected.. but it can't not open sale order and alert message "You are not permitted to perform this action [Message 200-30]".. so how can i set permitted to perform this action. pls help me...
    Thanks,
    Sivhour.

    Hi Prasan,
    Authorizations are set in under the Administration  System Initialization  Authorization  General Authorization.
    Regards,
    Vítor Vieira

  • Simple button script not working

    I am using AS2 and need help figuring out why this simple button script is not working:
    stop();
    buttonWS1.onRelease = function(){
                        gotoAndStop("Stage1and2_Boss",4);
    buttonWS2.onRelease = function(){
                        nextFrame();
    //end
    My buttons are the square letter-puzzles below. They are images that I converted to "symbols" (specifically, buttons). I put their names as above (buttonWS1, buttonWS2, etc.) in the "instance names" boxes.
    I have no idea what is going on. Please help!

    Hi -
    1. Yes, buttonWS2 is the instance name
    2. The only code attached to it is the code I pasted above.
    3. onRelease does not execute because my trace statement does not appear in the output
    Here is the modified code for buttonWS2:
    buttonWS2.onRelease = function(){
                        trace("clicked!");
                        nextFrame();
    Question: It shouldn't matter if I have commented-out code within that set of codes should it?:
    buttonWS2.onRelease = function(){
              //if (puzzleschosenarray[0] == 2 || puzzleschosenarray[1] == 2) {
              // cannot be chosen -- make button non-functional
              //else{
                        //puzzleschosenarray[roundnumber-1] = 2;
                        trace("clicked!");
                        nextFrame();

  • Simple button to play symbol....?

    I have a symbol "NA". It is an animated map that scales up and then back in place when closed. I have added a button to the main stage to play this symbol with the following code on the "click" event:
    sym.getSymbol("NA").play();
    What am I missing? Something, because it doesn't work for some reason.
    Simple button for a simple mind?
    Any and all help would be appreciated.

    Hi OneHorse,
    I've uploaded a file showing my above code working. Instead of just using "play", I'm telling it to play from a label: play("in"). If your "NA" symbol has autoplay unchecked, there may be some weird action when you tell it just "play()".
    www.timjaramillo.com/code/edge/_source/test.zip

Maybe you are looking for