var imgPath:String="http://93.97.40.201/snapshot/snaps/19cdeb13f7c46bfafa75beeca361c916.png";
var _loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
_loader.load(new URLRequest(imgPath));
function onProgress(e:ProgressEvent):void {
var _progress:String="Loading "+e.bytesLoaded+" of "+e.bytesTotal;
var _percent:Number=Math.round(100*e.bytesLoaded/e.bytesTotal);
trace(_percent + "%");
}
function onComplete(e : Event):void {
var loaderInfo:LoaderInfo=e.target as LoaderInfo;
var displayObject:DisplayObject=loaderInfo.content;
stage.addChild(displayObject);
trace("Loading Complete!");
}
Archive for the ‘Flash’ Category
AS3 Loading Images Externally
, 5 11th, 2010AS3/AS2 Dynamic Gradient Mask Effect
, 4 11th, 2010maskMovieClip = Instance name of your mask movie clip this is where you add the gradient/radial colour/type.
movieClip = Instance name of your movie clip you want masking.
AS3
movieClip.mask = maskMovieClip; maskMovieClip.cacheAsBitmap = true; movieClip.cacheAsBitmap = true;
AS2
movieClip.cacheAsBitmap = true;
maskMovieClip.cacheAsBitmap = true;
mask.cacheAsBitmap = true;
movieClip.setMask("maskMovieClip");
IE8 / Flash Player 10 Installation – Error: Failed to Register
, 1 28th, 2010Had to make a post about this as it was frustrating me so much, the issue came around when I was asked to upgrade my flash player version after entering an out of date webpage.. I am using Win7-64 OS.
Taken from Adobe TechNote - http://kb2.adobe.com/cps/494/cpsid_49419.html
You must have administrator privileges to successfully complete these instructions.
- Follow the instructions to download the SubInACL tool from the Microsoft Download Center.
- Install SubInACL.
- Download the reset_fp10.zip file.
- Extract the reset_fp10.cmd file to C:\Program Files\Windows Resource Kits\Tools\.
Important: Be sure that both the subinacl.exe and reset_fp10.cmd files are in the same location here: C:\Program Files\Windows Resource Kits\Tools\.
- Double-click reset_fp10.cmd.
- This will open a command window and execute the SubInACL tool.
- Do not use the machine while SubInACL is running.
- When it is finished you will see “Press any key to continue”.
- Install the Flash Player from www.adobe.com/go/getflashplayer.
BTW That didn’t work for me, what I did then was then, look for the “Adobe Download Manager” (C:\Program Files (x86)\NOS\bin) then right click > properties > Compatiblity > Compatiblity mode > check “run this program in compatibility mode for:” > Windows XP.
Then select check box, Privilege Level > run this program as an administrator.
You can do the same to all the files, reset_fp10.cmd /subinacl.exe, just to be sure the administration privledges as set and functioning..
AS3 detect page title and URL ExternalInterface.call
, 8 14th, 2009This is very handy script if you are trying to see where exactly the SWF has been loaded from you can read the Title of the page and the URL by using “ExternalInterface.call” method.
var title:String = ExternalInterface.call('window.document.title.toString');
var <a href="url:String">url:String</a> = ExternalInterface.call('window.location.href.toString');
res.appendText( "url = "+url+" \ntitle = "+title ); //add a text field to the stage called "res"
Example (note that this is sitting in a iframe @ http://sputn1k.co.uk/labs/url/)
AS3 Making thing’s Move the OOP way :)
, 7 3rd, 2009**Updated! – added more parameters/features.
Just wrote this small snippet of code right now shows how simple it is to get this moving with AS3 and and a OOP methodology. that’s it enjoy
/*///////////////////////////////////////////////////
Animate Script | by Kurt Grung - 3L3373.com
Usage:
---
"mc" movieClip = obj:Object
"type" x,y,alpha,rotate = prop:String
"style" Strong.easeOut = func:Function
"str" = begin:Number
"fin" = finish:Number
"len" = duration:Number [,useSeconds:Boolean=false]
See below for examples of use;
///////////////////////////////////////////////////*/
//imports
import fl.transitions.*
import fl.transitions.easing.*
//funtion
function animate(mc:MovieClip, type:String, style:Function, str:Number, fin:Number, len:Number){
//
var tween:Tween;
tween = new Tween(mc, type, style, str, fin, len, true);
}
//animations
animate(mc, "x", Strong.easeOut, -20, 300, .90 );
animate(mc, "y", Elastic.easeOut, -20, 200, .90 );
animate(mc, "alpha", Strong.easeOut, 0, 1, 3.5 );
AS3 Stage.width Stage.height Example
, 6 22nd, 2009Adobe has changed the syntax in AS3 for AS2 Stage.width/Stage.height equivalence (see below).
Code examples:
stage.stageWidth; stage.stageHeight;
Getting the middle of the stage.
stage.stageWidth/2 stage.stageHeight/2
Aligning your “MovieClip” into the middle of the stage.
MovieClip.x=stage.stageWidth/2-MovieClip.width/2; MovieClip.y=stage.stageHeight/2-MovieClip.height/2;
You don’t need to add the brackets – Replace “MovieClip” above with your MC instance name – That’s it you ready to roll.
Differences between ActionScript 1/2/3 :)
, 6 5th, 2009as3.0 is like a strict german mistress. Very harsh but gets good results.
as2.0 is your stoner friend from college.as1.0 is for script-kiddies, designers and other non-technical people
as2.0 is for girls
as3.0 is for real menas3.0 is carefully crafted formulaic pop – predictable, slick, reliable, dull
as2.0 is glitchy electronica – some semblance of form, but playful with it
as1.0 is a child bashing saucepans – imprecise, messy, but lots of funas3.0 is a Japanese Chef’s knife. Finely crafted but requires care and technique in its use.
as2.0 is a Machete. Great for hacking things, but useless for anything requiring fine detail or control.
as1.0 is a plastic spoon.
Haha!! amazing.
Found @ http://actionscripter.co.uk/blog/?p=237
IP BAN – PHP/MySQL Checking Script
, 6 2nd, 2009This is a small script can be used to redirect banned ip address users from your website, what it does exactly is calls the function “ipbanCheck” checks the database “ipban” for a matching IP Addresses of the current users IP Address then redirects them via javascript to = http://www.google.co.uk/search?q=GTFO
Database Setup:
1) log into phpMyAdmin, select the database you want the table built into.
2) select “SQL” from the tab menu, run the below.
SQL code:
CREATE TABLE ipban ( ID int(12) NOT NULL auto_increment, IP varchar(25) NOT NULL default '', PRIMARY KEY (ID) ) TYPE=MyISAM;
3) should output “executed successfully” etc. now select the table “ipban” then select “Insert” from tab menu now enter the IP Address your want to BAN in the field “IP”.
Usage:
Reason why i’m out putting the echo’s with outs like: “&conn=YES&IP=$ip” is for Flash loadVars integration. To use this function “ipbanCheck” just call it like so;
require_once 'ipban.php'; //file path to the file ipbanCheck(); //check function
Example
http://3l3373.com/dl/tutorials/ipBan/check.php – You should see an output of “&conn=YES&IP=93.97.40.201ban=NO&” unless You have been BANNED
PHP Code
<?php
/*
/////////////////////////////////
IP BAN - Kurt Grung - 3L3373.com
/////////////////////////////////
Database Setup:
1) log into phpMyAdmin, select the database you want the table built into.
2) select "SQL" from the tab menu, run the below SQL code:
CREATE TABLE ipban ( ID int(12) NOT NULL auto_increment, IP varchar(25) NOT NULL default '', PRIMARY KEY (ID) ) TYPE=MyISAM;
3) should output "executed successfully" etc. now select the table "ipban" then select "Insert" from tab menu now enter the IP Address your want to BAN in the field "IP".
Usage:
Reason why i'm out putting the echo's with outs like: "&conn=YES&IP=$ip" is for Flash loadVars integration.
To use this function "ipbanCheck" just call it liek so;
require_once 'ipban.php'; //file path to the file
ipbanCheck();
*/
function ipbanCheck(){
//config
$ip = $_SERVER['REMOTE_ADDR'];
$redirectURL = "http://www.google.co.uk/search?q=GTFO";
//db.conn
$dbHost = "";
$dbUser = "";
$dbPass = "";
$dbName = "";
//connection sucsessful?
$link = mysql_connect($dbHost, $dbUser, $dbPass, $dbName);
if(!$link){
die('&conn=NO&');
die('Could not connect: '.mysql_error());
}
echo '&conn=YES&IP='.$ip;
//db.conn
mysql_connect($dbHost, $dbUser, $dbPass) or die(mysql_error());
mysql_select_db($dbName) or die(mysql_error());
$s=$_SERVER["REMOTE_ADDR"];
//draws IP address of visitor
$ipbancheck="SELECT * from ipban where IP='$s'";
$ipbancheck2=mysql_query($ipbancheck);
while($ipbancheck3=mysql_fetch_array($ipbancheck2)){
$IPBANNED=$ipbancheck3[IP];
}
//above lines check to see if user Ip is in banned IPs
if ($IPBANNED){
//redirect user..
echo "<script> setTimeout(location.href=\"$redirectURL\", 1); </script>";
}else{
echo 'ban=NO&';
//put content you want unbanned users to see here
}
}
?>














