• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need help with linking buttons

Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Mar 05, 2012 Mar 05, 2012

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, pr

...

Votes

Translate

Translate
Enthusiast ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

I have added your code to care just get one button working.

I ran a preview and it worked.

Published it and the button dont work.

I tried also uploading it to another test server on an external host and it also does not work.

test server http://www.onlineaddicts.co.uk/test

This is with me using IE 9

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

I have removed the double xml load and moved it all to the root.

added the code to run all the buttons

moved code to display text from xml to root.

Buttons work via preview mode within flash but do not work once I publish.

I have updated the rar file with the new fla and updated the test url.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

I did update all the buttons and created the 5 functions to work off the mouse click events.

Sorry but you should still get a warning saying it couldnt reach the url..

I dont get anything after I publish it.

Is it a security setting I need to alter?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

I have just run the following tests.

Run the swf file locally via flash and links work.

Run index.html file locally and links work.

So is this an issue with apache???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2012 Mar 05, 2012

Copy link to clipboard

Copied

I haved setup a new windows 2003 server running xammp 1.7.7 and uploaded the files to it.

The links still do not work.

what is wrong?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 06, 2012 Mar 06, 2012

Copy link to clipboard

Copied

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 06, 2012 Mar 06, 2012

Copy link to clipboard

Copied

LATEST

Bingo...

I changed the link url in the xml file from

file:\\10.0.0.5\sdp$\ so on to http://www.google.co.uk and that worked.

So after that I tried it without the file:\\ protocal

\\10.0.0.5\sdp$\ and that works..

Thank you guys for all the hard work in helping a complete nub on this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines