Forum Topic: As3: Swf Protection!

(725 views • 7 replies)

This topic is 1 page long.

<< < > >>
Thinking

JoSilver

Reply To Post Reply & Quote

Posted at: 5/7/08 10:50 PM

JoSilver DARK LEVEL 15

Sign-Up: 09/21/07

Posts: 447

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

The Future Ruler of Newgrounds-
Jo Silver
AS3 Main: CHECK IT OUT NOOBS!

BBS Signature

Resigned

PyroflameGames

Reply To Post Reply & Quote

Posted at: 5/7/08 10:58 PM

PyroflameGames NEUTRAL LEVEL 09

Sign-Up: 08/04/07

Posts: 1,969

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.

4 in 5 people found this post helpful, did you? Yes | No

BBS Signature

None

Patareco

Reply To Post Reply & Quote

Posted at: 5/7/08 11:11 PM

Patareco LIGHT LEVEL 04

Sign-Up: 01/15/08

Posts: 77

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!


Kissing

JoSilver

Reply To Post Reply & Quote

Posted at: 5/7/08 11:17 PM

JoSilver DARK LEVEL 15

Sign-Up: 09/21/07

Posts: 447

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

The Future Ruler of Newgrounds-
Jo Silver
AS3 Main: CHECK IT OUT NOOBS!

BBS Signature

None

henke37

Reply To Post Reply & Quote

Posted at: 5/9/08 04:13 PM

henke37 NEUTRAL LEVEL 23

Sign-Up: 09/10/04

Posts: 3,658

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.


None

JoSilver

Reply To Post Reply & Quote

Posted at: 5/10/08 12:46 AM

JoSilver DARK LEVEL 15

Sign-Up: 09/21/07

Posts: 447

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.

The Future Ruler of Newgrounds-
Jo Silver
AS3 Main: CHECK IT OUT NOOBS!

BBS Signature

None

Patcoola

Reply To Post Reply & Quote

Posted at: 5/10/08 03:50 AM

Patcoola LIGHT LEVEL 46

Sign-Up: 03/07/03

Posts: 2,087

here's another related topic

Anti-Ebaum Script v1.0

copy protection by AS started with flash6

Website | Blog | Buy T-Shirts | Flash | Audio

BBS Signature

None

Cjross313

Reply To Post Reply & Quote

Posted at: 6/18/08 06:55 PM

Cjross313 DARK LEVEL 07

Sign-Up: 11/21/07

Posts: 11

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

Insanity is a true sign of genious...


All times are Eastern Standard Time (GMT -5) | Current Time: 02:43 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!