00:00
00:00
Newgrounds Background Image Theme

LancersNL just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As: JavaScript Functions

1,744 Views | 7 Replies
New Topic Respond to this Topic

As: JavaScript Functions 2006-07-19 04:17:41


AS: MAIN

Welcome to my Actionscript tutorial on javascript functions...

Your probably thinking WTF? so let me explain.

In AS using the getURL function you can run javascript functions!

heres an example:

on(press){
getURL("JavaScript:alert('hello');");
}

this can also be used for functions that have been defined in the <head> section of a html webpage if the SWF is also in the webpage.

for example:
The HTML Page HEAD Section:The SWF MUST be embedded in the same page.
<head>
<script>
function displayAnnoyingAlerts() {
alert('hello')
alert('how are you today?')
alert('bibi')
}
</script>
</head>

Javascript trigger button's AS:
on(press){
getURL("JavaScript:displayAnnoyingAlerts()
;");
}

The possibilities are endless!

Related Tutorials:
Pop Ups
The AS Reference

Report any errors!

Response to As: JavaScript Functions 2006-07-19 04:21:20


Cool! This is a really helpfull tutorial... I'm off to play around with it now!


...

Response to As: JavaScript Functions 2006-07-19 04:22:51


At 7/19/06 04:21 AM, Ng_begginer wrote: Cool! This is a really helpfull tutorial... I'm off to play around with it now!

Thanks, when i first worked out how to do it i had quite a bit of fun making stuff with it :)

Response to As: JavaScript Functions 2006-07-19 04:42:04


very nice. soon i will be getting into javascript (hopefully) and i saw a book or online tut and it had the exact same thing i was like WOW NFWAY didnt know it could be for flash. good luck for as main lol

Response to As: JavaScript Functions 2006-07-19 05:33:26


No.. no, just no.

This isn't a tutorial, it's a statement - you're just telling us that Flash can perform javascript operations using getURL. And anyway, this would be more of a programming forum kinda thing if it was done well (which it isn't, it's really bad).


Sup, bitches :)

BBS Signature

Response to As: JavaScript Functions 2006-07-19 05:37:59


At 7/19/06 05:33 AM, liaaaam wrote: This isn't a tutorial, it's a statement.

Yep. What good does it do if you told us this and we didn't know javascript?

Response to As: JavaScript Functions 2006-07-19 05:40:34


At 7/19/06 05:37 AM, --Storm-- wrote:
At 7/19/06 05:33 AM, liaaaam wrote: This isn't a tutorial, it's a statement.
Yep. What good does it do if you told us this and we didn't know javascript?

i cant teach you javascript in a small tutorial :P

Response to As: JavaScript Functions 2006-07-24 16:38:21


An example can be seen here:
http://img426.images..p?image=yoinkws2.swf