PDA

View Full Version : query strings, AAAAAAAHHH!!!!


sabresfan
06-17-2008, 03:19 PM
i'm desperate. i want my flash file to use an external image and link to a page in a popup window that is defined in my html doc. using a query string i was able to get the external image part down but not the link. please, can someone help me figure this out???

here is what i have so far (http://www.ronniesalvato.com/help) (click to see)


<script type="text/javascript">
AC_FL_RunContent(
'type', 'application/x-shockwave-flash',
'data', 'project.swf?source=projects/bird.jpg',
'width', '390',
'height', '100',
'movie', 'project?source=projects/bird.jpg'
);
</script>


the part thats not working is in bold:

import fl.transitions.*;
import fl.transitions.easing.*;

var borderSize = 10;

var photoURL:String = new String();
photoURL = String(this.loaderInfo.parameters.source);

var popupURL:String = new String();
popupURL = String(this.loaderInfo.parameters.url);

var imageLoader:Loader = new Loader();
var movOriginal:MovieClip = new MovieClip();
var movOver:MovieClip = new MovieClip();
var home:MovieClip = this;

imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE,onLoadedImage);
imageLoader.load(new URLRequest(photoURL));

function onLoadedImage(e:Event):void {

var g:Graphics = movOriginal.graphics;
g.clear();
g.beginFill(0x000000);
g.drawRect(0,0,imageLoader.width+borderSize*2,imag eLoader.height+borderSize*2);
g.endFill();
var g2:Graphics = movOver.graphics;

g2.clear();
g2.beginFill(0x83C15C);
g2.drawRect(0,0,imageLoader.width+borderSize*2,ima geLoader.height+borderSize*2);
g2.endFill();

movOver.alpha=0;
movOver.x = movOriginal.x = imageLoader.x-borderSize;
movOver.y = movOriginal.y = imageLoader.y-borderSize;

home.addChild(movOriginal);
home.addChild(movOver);
home.addChild(imageLoader);
}

imageLoader.x = 10;
imageLoader.y = 10;
imageLoader.addEventListener(MouseEvent.CLICK, doSomething);
imageLoader.addEventListener(MouseEvent.MOUSE_OVER , mouseOverHandler);
imageLoader.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);

function doSomething(Event:MouseEvent):void {
var _link:URLRequest = new URLRequest(popupURL);
navigateToURL(_link);
}

function mouseOverHandler(e:MouseEvent):void {
var myTween:Tween = new Tween( home.movOver, "alpha", Strong.easeOut, home.movOver.alpha, 1, 5, false);

}

function mouseOutHandler(e:MouseEvent):void {
var myTween:Tween = new Tween(home.movOver, "alpha", Strong.easeIn, home.movOver.alpha, 0, 5, false);

}

i need to figure out if the code in my actionscript is correct (probably not) and where to define the desired URL popup link in my html code. thanks in advance to anyone who can put me out of my misery.

Dail
06-17-2008, 08:00 PM
If you want to actually access the query string of your URL, try this;

var query:String=flash.external.ExternalInterface.call ("window.location.search.substring",1);

sabresfan
06-17-2008, 09:39 PM
im afraid my knowledge in doing this kind of stuff is pretty minimal. im more of a designer.

so should i replace the actionscript code that i have in bold with what you've given me?

and then how should i change my html code to make it work?