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