A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Cant get buttons to work on test or on server

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    5

    Question Cant get buttons to work on test or on server

    Hello,

    (Flash CS5 AS3)

    I have 4 buttons that I added the snippet code to "Go to Web Page" on the last frame of the timeline for each buttons instance name.

    In the publish setting I tried both Local playback security choices: "Access network and Access files local" Player 9.

    I can not get these to work at all.

    This is the code from the snippet:

    Code:
    stop();
    
    
    /* Click to Go to Web Page
    Clicking on the specified symbol instance loads the URL in a new browser window.
    
    */
    
    button_app.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_22);
    
    function fl_ClickToGoToWebPage_22(event:MouseEvent):void
    {
    	navigateToURL(new URLRequest("http://leargraphicdesign.com/opc_test/index.php?p=capabilities"), "_self");
    }
    
    /* Click to Go to Web Page
    Clicking on the specified symbol instance loads the URL in a new browser window.
    
    */
    
    button_food.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_23);
    
    function fl_ClickToGoToWebPage_23(event:MouseEvent):void
    {
    	navigateToURL(new URLRequest("http://leargraphicdesign.com/opc_test/index.php?p=foodservices"), "_self");
    }
    
    /* Click to Go to Web Page
    Clicking on the specified symbol instance loads the URL in a new browser window.
    
    */
    
    button_dff.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_24);
    
    function fl_ClickToGoToWebPage_24(event:MouseEvent):void
    {
    	navigateToURL(new URLRequest("http://df-foods.com/index_1.html"), "_blank");
    }
    
    /* Click to Go to Web Page
    Clicking on the specified symbol instance loads the URL in a new browser window.
    
    */
    
    button_global.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_25);
    
    function fl_ClickToGoToWebPage_25(event:MouseEvent):void
    {
    	navigateToURL(new URLRequest("http://www.oregonpotato.com/index2.html"), "_blank");
    }
    Test site: http://leargraphicdesign.com/opc_test/ Skip intro and it is the 4 buttons with icons on the bottom of the swf file.

    When testing local, I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at home_fla::MainTimeline/frame561()

    Frame 561 is the last frame.

    Thanks for any help and guidance!

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    My guess without seeing the file is that you have not named your button insyances, button_app, button_dff and so on.

    if this is not the fault then please attach your fla for scrutiny

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    5
    Hello,

    Yes I have them named as in the snippet code.
    I've uploaded the flash file to this link: download

    I only have 2 frames with actions.

    Thank you!

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Ok then, in your html page source code (page containing the swf) you have two lines saying this

    <param name="BGCOLOR" value="#000000" /> within the embed swf code.

    place underneath both of them, this

    <param name="allowScriptAccess" value="always" />

    explanation.

    You cannot navigate the special windows "_self", "_top", or "_parent" if your SWF file is contained by an HTML page that has set the allowScriptAccess to "none", without it is equivalent to none.

    good luck

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    5
    Thank you. I've been doing the process of elimination trying to see if I messed up with my instances names.

    I'll change that out and try again. Thank you for taking the time to look at my file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center