FORUMS: list search recent posts

XML driven menu built in ActionSript 3

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Lucy Dawkins
XML driven menu built in ActionSript 3
on Apr 25, 2011 at 9:45:20 am

I've downloaded a free XML driven image menu and currently when an image in the scrolling menu is clicked it opens the corresponding page in a blank window. I want to know how to make the new page open in self. I've added this command in the XML file:



From looking online I believe the action script is over riding this command? Here's the code:

import flash.filters.BitmapFilterQuality;

var loaderRotationSpeed = 2;

var useBitmapSmoothing = this.useBitmapSmoothing;

// load image
var url = this["info"].attributes.thumb;
var request1 = new URLRequest(url);
var loader1 = new Loader();

loader1.load(request1); //start loading img/swf
imgBox.addChild(loader1);

loader1.contentLoaderInfo.addEventListener("progress", progress_loading);
loader1.contentLoaderInfo.addEventListener("complete", finished_loading);

function progress_loading(e:Event) {

preanim.rotation+=loaderRotationSpeed;
}

function finished_loading(e:Event) {

//set bitmap smoothing
if (useBitmapSmoothing) e.target.content.smoothing = true;

//remove circle preloader
var la = this.getChildByName("preanim");
this.removeChild(la);
la = null;


}

If someone can let me know what code to place where that would be so helpful. Best wishes, Lucy


Return to posts index

demetri tashie
Re: XML driven menu built in ActionSript 3
on Apr 25, 2011 at 4:00:21 pm

hi lucy-

your XML code did not show up - probably because you used html tags ( less than/greater than symbols) in posting it.

i'm unclear if you are trying to call upon something ( a new web page, or an external image file) to be displayed OUTSIDE of your swf or not, as you are not showing us the relevant code to display from the XML file ( either 'navigate to url, or add child, etc ).

however, maybe this can help. the following code opens a page/image in the same browser window (see the use of the parameter '_self').

var urlReq:URLRequest = new URLRequest("http://google.com");
// or: var urlReq:URLRequest = new URLRequest("myImage.jpg");

navigateToURL( urlReq, '_self')

review your code to see if this can be fit in anywhere


Return to posts index

Lucy Dawkins
Re: XML driven menu built in ActionSript 3
on Apr 26, 2011 at 9:06:50 am

Hi Demetri

I wish to open a new web page from the swf menu. I've tried adding the code you supplied to the AS3 script and the xml file but I can't get it to work. The xml code is like this(I've removed the greater/less than symbols):

?xml version="1.0" encoding="utf-8" standalone="yes"?
images

img thumb="photo_tb/pic1.jpg" url="http://www.mysite.com/page1.html"TARGET="_self"/

img thumb="photo_tb/pic2.jpg" url="http://www.mysite.com/page2.html"TARGET="_self"/

I appreciate your help with this.


Return to posts index


demetri tashie
Re: XML driven menu built in ActionSript 3
on Apr 26, 2011 at 3:00:45 pm

ok, so now in your flash AS code make sure you are parsing the xml attributes correctly ( it looks like your attributes are 'thumb', 'url' and "TARGET")

BTW: if every one is being opened as '_self", there is no need to have that in the XML, as you can take care of that in the AS

your AS would need to look something like this:

navigateToURL( urlRequest, "_self")

where urlRequest is a new URLRequest based on the parsed xml attribute 'url' .


Return to posts index

Lucy Dawkins
Re: XML driven menu built in ActionSript 3
on Apr 26, 2011 at 4:59:55 pm

It is now working perfectly, thank you so much for your help Demetri.


Return to posts index

demetri tashie
Re: XML driven menu built in ActionSript 3
on Apr 26, 2011 at 5:05:48 pm

great!
glad to help


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]