PDA

View Full Version : How can I make this work? xml/Javascript/GetURL/Lightbox


BobGee
10-16-2009, 06:14 PM
private function onPress() {
onRollOut();
getURL("javascript:LightboxDelegate(node.attributes.url,no de.attributes.title)");
}

I am trying to edit existing code Horizontal Arrow Scroller to work with Lightbox.

The original script was using "node.attributes.url" and "node.attributes.title" to load the image in the original getURL code..

How can I make it work with the Javascript?

The Javascript is being called but the data is not being passed.

Please help :)

devilmaycry
10-16-2009, 11:37 PM
private function onPress() {
onRollOut(); getURL("javascript:LightboxDelegate("+node.attributes.url+","+node.attributes.title+")"); }


?

RogerClark
10-17-2009, 12:13 AM
If you need to call functions in the browser's javascript in AS3 you should be using the ExternalInterface class.

Take a look at the livedocs

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html

I didn't even think that getURL was available in AS3 - are you sure you're doing the project in ActionScript 3 not ActionScript 2. So you're either using the wrong call or posting to the wrong forum

BobGee
10-17-2009, 05:29 AM
private function onPress() {
onRollOut(); getURL("javascript:LightboxDelegate("+node.attributes.url+","+node.attributes.title+")"); }


?

I originally thought that is what I needed but it doesn't work.

Any ideas?

If you need to call functions in the browser's javascript in AS3 you should be using the ExternalInterface class.

Take a look at the livedocs

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html

I didn't even think that getURL was available in AS3 - are you sure you're doing the project in ActionScript 3 not ActionScript 2. So you're either using the wrong call or posting to the wrong forum

OOps you are correct it's AS2 not AS3 I posted this in the wrong section.

I figured i'd be able to pass the node.attributes thru the Javascript just like with the original GetURL code using the same node.attributes.

Any input?

devilmaycry
10-17-2009, 09:38 AM
ExternalInterface works too in AS2, ExternalInterface.call(LightboxDelegate,param1,par am2);

BobGee
10-17-2009, 06:52 PM
ExternalInterface works too in AS2, ExternalInterface.call(LightboxDelegate,param1,par am2);

I'm a complete newb to AS.

How would I go about adding that in place of the get url? Got a link to a tutorial?

I really just want to make the node.attributes work with as little modification as possible.

any help?

devilmaycry
10-18-2009, 10:38 PM
try like this


private function onPress() {
onRollOut();
ExternalInterface.call('LightboxDelegate',node.att ributes.url,node.attributes.title);

}

BobGee
10-19-2009, 08:07 AM
try like this


private function onPress() {
onRollOut();
ExternalInterface.call('LightboxDelegate',node.att ributes.url,node.attributes.title);

}


Nope no luck

I also added "import flash.external.ExternalInterface;"

it runs the script but does not send the data from the attributes.

RogerClark
10-19-2009, 08:18 AM
trace out node.attributes.url,node.attributes.title

private function onPress() { onRollOut();
trace("Values are ",node.attributes.url,node.attributes.title);

ExternalInterface.call('LightboxDelegate',node.att ributes.url,node.attributes.title); }

and in your javascript

function LightboxDelegate(v1,v2)
{
alert(v1 +" "+ v2);
etc
etc
}

i.e. does Flash have the correct value to pass to Javascript and is javaScript recieving the parameter

BobGee
10-23-2009, 07:25 PM
try like this


private function onPress() {
onRollOut();
ExternalInterface.call('LightboxDelegate',node.att ributes.url,node.attributes.title);

}



I'm sorry this actually did work. I must have not saved before uploading.

Thanks!