Skip navigation
DirtySnipe007
Currently Being Moderated

Need help with linking buttons

Mar 5, 2012 2:14 AM

Tags: #problem #button #xml #actionscript3

Can anyone help me with this problem I have.

 

I have a gfx which I have created 6 shapes and converted them into simple buttons. I have urls sat inside an xml file. How can I get the buttons to use the urls set from within the xml file?

 

Also how can I change the current external photo that is being loaded to load the url from a setting in the same xml file.

 

I hope you arnt as confused as I am right now.

 

I have packaged up the flash file which includeds the xml aswell.

 

If anyone could help me out with this I would be very greatful.

 

Thanks All

 

http://www.onlineaddicts.co.uk/menu.rar

 
Replies
  • Currently Being Moderated
    Mar 5, 2012 3:35 AM   in reply to DirtySnipe007

    Remove the code from all btns, as below paste it on main timeline

     

    Also no need to load xml twice as dome in image container...

     

    give an instance name to the outer container of btns - menumv

     

    use following method to openURL, use same for all the btns..

     


     

     

    import flash.events.Event;


    import flash.events.MouseEvent;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    var myXML:XML;

    var myLoader:URLLoader = new URLLoader();

    myLoader.load(new URLRequest("links.xml"));

    myLoader.addEventListener(Event.COMPLETE, processXML);

     

    function processXML(e:Event):void

    {


    myXML = new XML(e.target.data);

    trace(myXML);

    menumv.carbtn.addEventListener(MouseEvent.CLICK, openURL);

    }

     

    function openURL(e:MouseEvent):void

    {


    navigateToURL(new URLRequest(myXML.car.url));

    }

     

    --

    http://www.darshanrane.com

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2012 5:06 AM   in reply to DirtySnipe007

    You need to update the files, you are linking your local links...

    http://www.onlineaddicts.co.uk/test/links.xml

     

    Also you need to replicate this line for all your btn

    menumv.carbtn.addEventListener(MouseEvent.CLICK, openURL);

     

    And this function as well

     

    function openURL(e:MouseEvent):void

    {


    navigateToURL(new URLRequest(myXML.car.url));

    }

     

    Not an optimized solution as you need to right 5 functions, but should work.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2012 12:44 AM   in reply to DirtySnipe007

    Dont know whether apache will block the page request, it should not. Check out if there is some explict settings...

     

    Just as a QC, try a simple one btn click opens a html file in a separate file and test whether your setup works on apache...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points