Archive for May, 2012

Smoky Trailer in Flash Action script

Final Preview:

Step-1 Open a new document in flash. Set the stage color as black.

Step-2 Create four buttons for smoke colors transformation in Layer-1. Give the instance name for each button. Here  I gave one_btn, two_btn, three_btn and four_btn.

Step-3 Type the following Action Script in Layer-2.

//import bitmap class
import flash.display.BitmapData;
var currentBitmap:String = “smoke_yellow_blue.png”;
function doTrail(container:MovieClip, targetX:Number, targetY:Number, type:String):Void
{
//attach bitmap from the library with the linked name “adobe_flash”
var myBmp:BitmapData = BitmapData.loadBitmap(currentBitmap);
//create the “main_holder” movieclip that will hold our bitmap
var _particle = container.createEmptyMovieClip(“main_holder”+container.getNextHighestDepth(), container.getNextHighestDepth());

//create an “internal_holder” movieclip inside “main_holder” that we’ll use to center the bitmap data
var internal_holder:MovieClip = _particle.createEmptyMovieClip(“internal_holder”, _particle.getNextHighestDepth());
//set “internal_holder” x and y position based on bitmap size
internal_holder._x = -myBmp.width/2;
internal_holder._y = -myBmp.height/2;

//finally, attach the bitmapData “myBmp” to the movieclip “internal_holder”
internal_holder.attachBitmap(myBmp, internal_holder.getNextHighestDepth());

//set the particle’s x & y position based on the target x & y. Offset the particle by a few pixels
_particle._x = targetX + random(4)-8;
_particle._y = targetY + random(4)-8;
//randomly rotate the particle 360 degrees
_particle._rotation = random(360);
//give the particle a random scale, between 50% and 100%
var randomScale = random(50)+50;
_particle._xscale = randomScale;
_particle._yscale = randomScale;
//give each particle its own speed
_particle.speed = random(5)+3;
//make it move
_particle.onEnterFrame = function ()
{
this._xscale += this.speed;
this._yscale += this.speed;
this._alpha -= this.speed;
//check if particle is invisible, and remove it
if(this._alpha <= 0)
{
delete this.onEnterFrame;
removeMovieClip(this);
}
}
}
_root.onEnterFrame = function():Void
{
doTrail(_root, _xmouse, _ymouse, currentBitmap);
}
//*** Control Buttons***//
one_btn.onRelease = function(){
currentBitmap = “clear.png”;
}
two_btn.onRelease = function(){
currentBitmap = “smoke_clear.png”;
}
three_btn.onRelease = function(){
currentBitmap = “smoke_yellow_blue.png”;
}
four_btn.onRelease = function(){
currentBitmap = “smoke_yellow_orange.png”;
}

Step-4 Import smoke effect images to library. Images name should be same as in library and script. Go to library panel and right click on each image.  Choose Properties à Linkage. Check the “Export for Action script” option.

Run the program.

Tags: , ,

Tuesday, May 22nd, 2012 Flash, web design, web design tips No Comments

Solution for HTML5 Accessibility in IE

OUTPUT (in IE) AFTER FIXING THE SOLUTION:

html5-solution-in-ie
image-1823

OUTPUT (in IE) BEFORE FIXING THE SOLUTION:

html5-without-solution-in-ie
image-1824

HTML5 CODE:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/HTML" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<title>My first HTML5 website</title>
</head>
<body style="padding-left: 35px;">
<header> Header Tag of HTML5 with
<nav><a href="#">&lt;nav&gt;</a> </nav>
</header>
<article>
<section>
<h2>Article & section Tag</h2>
<p>[…]</p>
<p>[…]</p>
<p>[…]</p>
</section>
</article>
<footer>Footer Tag of HTML5 </footer>
</body>
</html>

CSS CODE:

header {
background: #9e9e9e;
width: 600px;
height: 25px;
color:#FFF;
font-size:20px;
display: block;
text-align:center;
}
header a {
color: #FFF;
}
header a:hover {
color: #ebebeb;
}
article{
color: #CCC;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
}
footer {
background: #9e9e9e;
width: 600px;
height: 25px;
color:#FFF;
font-size:20px;
display: block;
text-align:center;
}

The main script should be added to the section. It only can access the HTML5 in IE. Without the below script you will not get the required output.

html5-solution-script
image-1825

That’s it…

Tags: , , , ,

Wednesday, May 2nd, 2012 HTML, web design, web design tips No Comments
Request a Free SEO Quote