Archive for the ‘Flash’ Category

AS3 Loading Images Externally

Tuesday, May 11th, 2010
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!");
}
Vote in HexoSearch

AS3/AS2 Dynamic Gradient Mask Effect

Sunday, April 11th, 2010

maskMovieClip = 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");
Vote in HexoSearch

IE8 / Flash Player 10 Installation – Error: Failed to Register

Thursday, January 28th, 2010

Had 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.

  1. Follow the instructions to download the SubInACL tool from the Microsoft Download Center.
  2. Install SubInACL.
  3. Download the reset_fp10.zip file.
  4. 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\.

  5. Double-click reset_fp10.cmd.
  6. This will open a command window and execute the SubInACL tool.
  7. Do not use the machine while SubInACL is running.
  8. When it is finished you will see “Press any key to continue”.
  9. 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..

Vote in HexoSearch

Flash AS3 clickTag & clickTAG-substr Snippets

Friday, October 23rd, 2009

This have changed since AS2 clickTags ;0 I have two examples below, clickTag normal way and clickTAG with substr as some adservers use that convention, you should checkout Banner Flow easy tool to test if clickTags are working correctly.

AS3 clickTag Code:

import flash.display.LoaderInfo;
var clickTag = root.loaderInfo.parameters.clickTag;
var url:String = "http://domainName.com"; //I use this as its better when sending to clients when the click down on the banners they don't see a 'Undefined' blank page.
clickTagBtn.addEventListener(MouseEvent.MOUSE_DOWN, clickTagPress);

function clickTagPress(event:MouseEvent):void {
	if( clickTag == undefined ){
		//
		var request:URLRequest = new URLRequest(url);
		flash.net.navigateToURL(request, "_blank");
	}else{
		//
		var requestCT:URLRequest = new URLRequest(clickTag);
		flash.net.navigateToURL(requestCT, "_blank");
	}
}

AS3 clickTAG-substr code:

var url:String = "http://domainName.com"; //Again - I use this as its better when sending to clients when the click down on the banners they don't see a 'Undefined' blank page.
var ct:String = LoaderInfo(root.loaderInfo).parameters.clickTAG;
if (LoaderInfo(root.loaderInfo).parameters.clickTAG){
    clickTagBtn.addEventListener(MouseEvent.MOUSE_UP, ctPress);
}else{
    clickTagBtn.addEventListener(MouseEvent.MOUSE_UP, urlPress);
}
function ctPress(event:MouseEvent):void{
	if (ct.substr(0,4) == "http") {
		navigateToURL(new URLRequest(ct), "_blank");
	}
}
function urlPress(event:MouseEvent):void{
	navigateToURL(new URLRequest(url), "_blank");
}
Vote in HexoSearch

AS3 detect page title and URL ExternalInterface.call

Friday, August 14th, 2009

This 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/)

Adobe Labs
AS2
AS3

Vote in HexoSearch

AS3 Making thing’s Move the OOP way :)

Friday, July 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 );
Vote in HexoSearch

Posting Content to Myspace via Flash or HTML

Thursday, June 25th, 2009

For example:

http://www.myspace.com/Modules/PostTo/Pages/?t=TITLE&c=CONTENT&u=URL&l=1

Replace the query strings with your content. Here is the dissection of the Myspace query strings.  All data needs to be passed “escaped”.  From what I have seen is Myspace disables to click-throughs from SWF embedded content.

Actionscript “escape” example:

var escapeDATA:String = "< OMFGBBQ_ THIS PWNZ - w00t!! >";
escapeDATA = escape(escapeDATA);
trace("escapeDATA= "+escapeDATA);
?t=

TITLE

?c=

CONTENT – this where you would add your embed tags.

i.e. this is encoded/escaped string.

<embed width%3D'555' height%3D'360' allowFullScreen%3D'true' allowNetworking%3D'all' allowScriptAccess%3D'always' src%3D'http%3A%2F%2Fdomainname.com%2Fdir%2Fname.swf' type%3D'application%2Fx-shockwave-flash' >
?u=

URL

l=

1 = blog
2 = bulletin
3 = profile, about me

Vote in HexoSearch

AS3 Stage.width Stage.height Example

Monday, June 22nd, 2009

Adobe 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.

Vote in HexoSearch

Differences between ActionScript 1/2/3 :)

Friday, June 5th, 2009

as3.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 men

as3.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 fun

as3.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

Vote in HexoSearch

IP BAN – PHP/MySQL Checking Script

Tuesday, June 2nd, 2009

This 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 like 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
 }
}

?>
Vote in HexoSearch
  • Categories

  • Recent Comments

  • Recent Posts

  • Tumblr

  • Flickr Recent Photos

    cherry tree woodstonja_gravestonesPockey Chimp FlavourAUTO FTW! :)darkdaystayouttiger kittenbirdofpreyfirst photo i took with my 1000dself_portrait_02
  • XFIRE (wkly hrs pld)

  • Last.FM

  • Tags

    .MP4 Actionscript Action Script Advertising AS2 AS3 backtrack BT4 bug Call of Duty capcom centOS cpanel crossdomain Eyeblaster eyeblaster HD f4v Flash h264 HD high definition Install internet explorer Linux load loadMovie MIME MIME Types MW2 Nazi Zombies pc PHP ports preloader release date rich media shared objects Stage SWF SWFOBJECT torrents Video video/mp4 VMware win7