00:00
00:00
Newgrounds Background Image Theme

YubaOfficial 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!

As3: Swf Protection!

3,181 Views | 7 Replies
New Topic Respond to this Topic

As3: Swf Protection! 2008-05-07 22:50:53


AS3: Main

Hello, I'm a Jo Silver and I'm making this tutorial because there is no

tutorials of it's kind for AS3.

INTRODUCTION
Many people will eventually get their Submissions stolen by some A-hole

looking to profit from your hard work. normally when this occurs you'll

scream at the top of your lungs a long slew of profanities! Then the cops

arrive and throw you in an insane asylum, but fortunately I'm writing

this Tutorial so that and on working with AS3 can skip the entire process

all together.

Step:1
To start of Create a new AS3 Document and open up the actions panel of

the first frame.

Now start off by typing this code

import flash.display.*;

this just loads the necessary things to build the code.
then create a new string.

var Good_url:String = "http://www.yourwebsite.org/yourcrap"

you don't have to put "www.yourwebsite.org" in case you couldn't figure

that out. This code works best if you put the exact URL that your SWF is

embedded in.

loaderInfo

In AS2 in oder for your SWF to return the URL of where the SWF you would

have to put the following...

trace(_root._url);

your output window would have the URL of the SWF. however in AS3 the _url

property has been omitted but not to worry, there is a way around it.

trace(this.loaderInfo.url);

this gets you the same output as the the previous code but for AS3.
DisplayObject.loaderInfo.url is the AS3 replacement for "_url".
remember in the code above "this" refers to the stage so it returns the

URL of the stage.

Step2:

the next part of the code is the following...

var this_url:String = this.loaderInfo.url;

this creates a string that is the URL of that the SWF is on.
then we make an "if" statement.

if(this_url.indexOf(good_url) ==0)
{
play();
}else{
gotoAndStop("youSUCK!!!");
}

remember this code assumes there is no preloader in your movie or

game and that it will play despite the fact that the movie has yet to

load.

this code means that if this_url contains any part of good_url the movie

will play or else it will go to the frame labeled "youSUCK!!!" not that

the frame it goes to has to be named this, I put it like this to give you

the basic Idea of what i suggest you should put on this frame =)

and the last thing you need to do is hide the built in context menu items

and put hateful messages
on the frame labeled "youSUCK!!!"

Overview

let go over what we've got so far.

import flash.display.*;

var Good_url:String = "http://www.yourwebsite.org/yourcrap"
var this_url:String = this.loaderInfo.url;

if(this_url.indexOf(good_url) ==0)
{
play();
}else{
gotoAndStop("youSUCK!!!");
}

import flash.display.*;

this import the necessary things

var Good_url:String = "http://www.yourwebsite.org/yourcrap"
var this_url:String = this.loaderInfo.url;

this creates the need strings.

if(this_url.indexOf(good_url) ==0)
{
play();
}else{
gotoAndStop("youSUCK!!!");
}

and this last piece creates the protection code.

that just about concludes this tutorial, remember use the whole URL to

make your code more efficient and hide the built in context menu items.

If you fail to do so your code will be completely useless to you.

I hope this helps you and YOUR WELCOME!!!!!!

Response to As3: Swf Protection! 2008-05-07 22:58:26


At 5/7/08 10:50 PM, JoSilver wrote: Many people will eventually get their Submissions stolen by some A-hole

looking to profit from your hard work. normally when this occurs you'll

scream at the top of your lungs a long slew of profanities!

Not a problem with me, I just put a link to my website in there, and then I could care less who took it. But this is a great tutorial nonetheless, and will really help out people who want something like this with As3.


BBS Signature

Response to As3: Swf Protection! 2008-05-07 23:11:17


i'm not very concerned whit stealing but this is a very interesting script regardless, you could even open a webpage in case you are not in the right url! didn' knew the swf could return the current internet address!

Response to As3: Swf Protection! 2008-05-07 23:17:01


At 5/7/08 11:11 PM, Patareco wrote: i'm not very concerned whit stealing but this is a very interesting script regardless, you could even open a webpage in case you are not in the right url! didn' knew the swf could return the current internet address!

well....IT CAN!!!!

you learn something new everyday and the a start to a good day is a balanced BREAKFAST!!!!!!

Response to As3: Swf Protection! 2008-05-09 16:13:08


Do note that it can not check what page is embedding the file, only where the swf is hosted.
Also, you might want to allow urls that begin with file://, otherwise local copies won't be allowed.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.

Response to As3: Swf Protection! 2008-05-10 00:46:26


At 5/9/08 04:13 PM, henke37 wrote: Do note that it can not check what page is embedding the file, only where the swf is hosted.
Also, you might want to allow urls that begin with file://, otherwise local copies won't be allowed.

Eh, what can I say. I ain't no wiz a this stuff, I made this because it seems no one else was going to And it took a long time to figure it out. like eveyone else who is checking this im learning too.

Response to As3: Swf Protection! 2008-05-10 03:50:29


here's another related topic

Anti-Ebaum Script v1.0

copy protection by AS started with flash6

Response to As3: Swf Protection! 2008-06-18 18:55:40


very interesting method... I might want to look into other uses... >=D


Insanity is a true sign of genious...