February 2012
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
272829  

SWF History

Please open flash IDE and draw something
s1

In the properties panel you can see ’swf history’ and there will be nothing
s11

Test a movie your file
s2

Then look to swf history and you will see date, time and size
s3

Make some modification with your flash file
s4

And then compile it again and look to swf history. So as you see size is changed and time is changed. So now we can see our swf history
s5

Color Panel

Please open Flash Professional CS5. Create new file there and draw simple rectangle.
c1

Then open color panel
c2

So as you see there you can change color and using alpha, all very useful.
c3

How to cheat flash

cheat

Serfing the net i find cool books. I want to show you it for you:)

How to Cheat in Flash CS3: The art of design and animation in Adobe Flash CS3

1

How to Cheat in Flash CS3

Review

If you have ever stared at a blank stage wondering how to make your ideas into reality, this is how it’s done. I consider each example a best practice of how to use Flash CS Professional.
Justin Everett-Church, Sr. Product Manager Flash Player, Adobe Systems

Chris Georgenes’ gorgeously designed book contains many short, practical tutorials that both Flash animators and web designers will want to thumb through to learn the tricks of the trade, so they can really impress their clients.”
Stefan Gruenwedel, Sr. Editor, Developer Center, Adobe Systems

This is a not-to-be-missed chance to get secrets from one of the foremost authorities on Flash animation. His techniques for animating characters are essential for anyone dreaming of creating a cartoon or animated feature.
Craig Goodman, Executive Editor, Developer Center, Adobe Systems

This is a must-have Flash book. Whether you consider yourself more a Flash designer or developer, you’ll want to run home and try out the concepts and techniques in this beautifully presented book.
Tim Statler, Flash developer, Adobe Systems

A valuable resource loaded with helpful tips and hints for Flash users at all skill levels. It is filled with practical how-to examples for artists and animators, presented in a clear step-by-step manner with illustrations documenting each step along the way.
Jim Ver Hague, Professor Emeritus, Computer Graphics Design, Rochester Institute of Technology

..a must have book if you are a Flash designer/animator.
flashculture.com

Book Description

Real world guide which will save designers time and money and ensure they get the best out of Flash!

How to Cheat in Adobe Flash CS4: The art of design and animation

2

How to Cheat in Adobe Flash CS4

Review

“As a veteran Flash animator, Chris offers the reader a wealth of traditional Flash animation techniques; however, what makes this book even more valuable is the knowledge he offers of ways to use the latest features in the current tool.” -Richard Galvan, Product Manager, Flash

“Chris effortlessly breaks down complicated topics into easy-to-learn nuggets of digital animation wisdom. You learn everything a Flash animator wants-lip syncing tricks, walk-cycles, photo cut-out animation and even more advanced concepts like frame-by-frame traditional animation.” -Aaron Simpson, Animation Producer and Founder of ColdHardFlash.com

“Through it’s refreshing and approachable design, this book was an instant hit and invaluable resource in our studio. We often recommend it to Flash newbies who are starting on their creative journey.” -Gray Goldberger, Animation Director, Fablevision

Book Description

A new edition of the best selling How to Cheat in Flash by reknowned Flash expert, Chris Georgenes, with all new content for the Flash CS4 revision.

How to Cheat in Adobe Flash CS5: The Art of Design and Animation

3

How to Cheat in Adobe Flash CS5

Book Description

A new edition of the bestselling How to Cheat in Adobe Flash, the real-world guide that saves designers time and money by renowned Flash Expert, Chris Georgenes, with all-new content for the Flash CS5 revision

Product Description

Need to solve problems quickly to develop creative projects to time and to budget? Want to hone your Flash skills so you can concentrate on your animation? Then How to Cheat in Flash is for you! Chris Georgenes shows how to work from the problem to the solution - from the viewpoint of an animator who has been commissioned to create a job and is working to a deadline and to a budget.

With his in-depth knowledge of the little-known secrets used by the pros to produce creative, professional animations, Chris is the go-to guru for designers and animators who want to create great animation, applications or motion design with Flash. Fully updated for CS5, How to Cheat in Flash CS5, is a goldmine of artistic inspiration, timesaving practical tips, tricks and step-by-step workthroughs that you’ll wonder how you survived without it.

Each techniques is designed as a double-page spread so you can prop the book up behind your keyboard or next to your monitor as a visual reference while working alongside it. Many of these workthroughs are real-world client projects, with the source files supplied for you to open and explore. With these real-life professional projects you’ll discover how to: bring objects to life with cool motion effects, make it rain, snow or set your world ablaze, develop flash mobile applications and many more tips and tricks not found anywhere else!

* Work over the shoulder of Chris Georgenes, renowned Flash expert, and apply the practical techniques, tips and tricks to your own projects with downloadable Flash source files, examples and tutorials, available at www.howtocheatinflash.com.  

* Bestselling How to Cheat coverage of Flash CS5 - proven format for successful learning
* Learn a myriad of tips and tricks based on real-life working methods to help you work faster and more efficiently and to budget!
* Work from the problem to the solution, to gain the best possible results from Flash CS5!

 

Matching Things game

Try to match things in this game. Matching things game with source files.

m1

m2

m3


package
{
import adobe.utils.CustomActions;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.events.*;
import flash.utils.getTimer;

public class MyMatching extends MovieClip
{
public var xIconsContainer;//all icons start to draw from this x
public var yIconsContainer;//all icons start to draw from this y

private var iconsVertical=2;//icons columns
private var iconsHorizontal=2;//icons rows

private var firstIcon;//player click to first icon
private var secondIcon;//player click to second icon

private var deletedIcons:int = 0;//if firstIcon==secondIcon we will delete 2 icons
public var numberOfLevels:int = 6;//2 for 1 level; 4 for 1, 2 levels; 6 for 1, 2, 3 levels

public var startTime:int = getTimer();
public var timeString:String;

public var playerScoreSum:int = 0;//sum of all players points

public var iconsList:Icon;
public var iconsArray:Array;

public var iconWidth:int = 51;//width of icon
public var iconHeight:int = 51;//height of icon

public var levelNumber:int = 1;

public var matchPoints:int = 20;//if player match 2 icons we add 20 points to his playerScoreSum
public var missPoints:int = 1;//if miss we delete 1 points from playerScoreSum

//constructor
public function MyMatching()
{
welcomeScreen();
}

public function welcomeScreen():void
{
trace("+++ Welcome screen +++");
gotoAndStop('WelcomeScreen');
playBtn.addEventListener(MouseEvent.CLICK, goToLevels);
}

public function startingStopwatch():void
{
addEventListener(Event.ENTER_FRAME, stopwatch);
}

public function stopingStopwatch():void
{
removeEventListener(Event.ENTER_FRAME, stopwatch);
}

public function stopwatch(event:Event)
{
var timePassed:int = getTimer()-startTime;
var seconds:int = Math.floor(timePassed/1000);
var minutes:int = Math.floor(seconds/60);
seconds -= minutes*60;
timeString = minutes + ":" + String(seconds + 100).substr(1, 2);
if ( stopwatchPreview != null )
stopwatchPreview.text = String(timeString);
}

public function goToLevels(event:MouseEvent)
{
xIconsContainer=stage.stageWidth/2 - (iconWidth*iconsHorizontal)/2;//all icons start to draw from this x
yIconsContainer=stage.stageHeight/2 - (iconHeight*iconsVertical)/2;//all icons start to draw from this y
startingStopwatch();

trace("+++ Levels screen +++");
iconsArray = new Array();//creating new object iconsArray

gotoAndStop('Levels');

for (var i:int; i < iconsVertical*iconsHorizontal/2; i++)
{
iconsArray.push(i);
iconsArray.push(i);
}

trace(">>> array: ” + iconsArray);

for (var x:int = 0; x < iconsVertical; x++)
{
for (var y:int = 0; y < iconsHorizontal; y++)
{
iconsList = new Icon();
addChild(iconsList);
iconsList.buttonMode = true;//if we move cursor to icon we can see hand
iconsList.stop();//stoping our icons on Flash IDE, because on one layer we have all our icons
iconsList.x=x*iconWidth+xIconsContainer;
iconsList.y=y*iconHeight+yIconsContainer;
var myRandom:int=Math.floor(Math.random()*iconsArray.length);//creates a random number that will be related to an index of the array named "iconsArray"
//var showIcon;//cast as whatever type of element the array is holding
iconsList.showIcon=iconsArray[myRandom];//assigns the randomly selected element of iconsArray to the variable showIcon
iconsArray.splice(myRandom,1);//removes the randomly selected element (now showIcon) from the array (not the last one, the random one) //we use the splice command to remove number from the array so that it won’t be used again
//iconsList.gotoAndStop(iconsList.showIcon+2);//showIcon+2 would be the next frame in the timeline after the frame for the random item deleted, so that code is essentially moving in the timeline to the frame just after the frame for the item that was removed from the array
trace(">>> random numbers: ” + myRandom);
iconsList.addEventListener(MouseEvent.CLICK, clickToIcon);
deletedIcons++;//when we draw icons we every time add +2 icons to our deletedIcons variable, in future we will deleted 2 icons from this variable if firstIcon==secondIcon
}
}

//added score to the sceen
trace(”****** Icons creationg finished ******”);
trace(”Level: ” + levelNumber + ” started”);
}

public function clickToIcon(event:MouseEvent)
{
var thisIcon:Icon = (event.currentTarget as Icon);//what icon player clicked…
trace(”Icon ” + thisIcon.showIcon + ” was clicked”);//trace clicked icon to the output pannel
if (firstIcon==null)
{
firstIcon=thisIcon;
firstIcon.gotoAndStop(thisIcon.showIcon + 2);
}
else if (firstIcon == thisIcon)
{
firstIcon.gotoAndStop(1);
firstIcon=null;
}
else if (secondIcon==null)
{
secondIcon=thisIcon;
secondIcon.gotoAndStop(thisIcon.showIcon + 2);

if (firstIcon.showIcon==secondIcon.showIcon)
{
playerScoreSum += matchPoints;// add matchPoints for all existing player points
scoreGamePreview.text = String(playerScoreSum);
trace(”+ added ” + matchPoints + ” points because matching of 2 icons. ” + “Now player has: ” + playerScoreSum + ” points”);

removeChild(firstIcon);
removeChild(secondIcon);
deletedIcons -= 2;
trace(”— deleted 2 icons —”);
if (deletedIcons == 0)
{
if (iconsVertical >= numberOfLevels)
{
iconsVertical = 2;
iconsHorizontal = 2;
levelNumber = 1;
MovieClip(root).playerScoreSum = playerScoreSum;
stopingStopwatch();
startTime = getTimer();
gotoAndStop(’GameoverScreen’);
trace(”+++ Gameover Screen +++”);
}
else
{
iconsVertical += 2;
iconsHorizontal += 2;
levelNumber += 1;
xIconsContainer+=2;
yIconsContainer+=2;
goToLevels(null);
}
}
}
else
{
playerScoreSum -= missPoints;// delite missPoints from all existing player points
scoreGamePreview.text = String(playerScoreSum);
trace(”- deleted ” + missPoints + ” points because missing of 2 icons. ” + “Now player has: ” + playerScoreSum + ” points”);
}
}
else
{
firstIcon.gotoAndStop(1);
secondIcon.gotoAndStop(1);
firstIcon = null;
secondIcon = null;
firstIcon=thisIcon;
firstIcon.gotoAndStop(thisIcon.showIcon + 2);
}
}

}
}

Source:
Matching Things

Coin Toss game

Try to coin toss;)
Full Sources.

ct1

ct2

ct3


package
{
import flash.display.*;
import flash.events.*;
import flash.display.MovieClip;
import fl.controls.RadioButtonGroup;

import fl.transitions.Tween;
import fl.transitions.easing.*;

import flash.ui.Mouse;

import flash.display.Sprite;
import flash.utils.*;

import flash.media.Sound;
import flash.media.SoundChannel;

public class CoinToss extends MovieClip
{
var radioGroup1:RadioButtonGroup=new RadioButtonGroup("Coin Loss");

var randomNumber:Number;
var points:Number = 500;

// set up sounds
var theCorrectSound:CorrectSound = new CorrectSound();
var theWrongSound:WrongSound = new WrongSound();

//constructor
public function CoinToss()
{
//changing existing cursor to our custom
Mouse.hide();
addEventListener(Event.ENTER_FRAME, cursorPosition);
my_cursor.mouseEnabled = false;

gameMenu();
}

function cursorPosition(event:Event)
{
my_cursor.x = mouseX;
my_cursor.y = mouseY;
}
//******************************************************************************
//main game menu
public function gameMenu():void
{
gotoAndStop('homeScreen');
trace("************ We are on HOME Screen ********************");

homeBtn.addEventListener(MouseEvent.CLICK, homeScreen);
playGameBtn.addEventListener(MouseEvent.CLICK, gameScreen);
howToPlayBtn.addEventListener(MouseEvent.CLICK, howToPlayScreen);
moreGamesBtn.addEventListener(MouseEvent.CLICK, moreGamesScreen);
thanksBtn.addEventListener(MouseEvent.CLICK, thanksScreen);
}

public function homeScreen(event:MouseEvent):void
{
gotoAndStop('homeScreen');
trace("************ We are on HOME Screen ********************");
var homeScreen:Tween = new Tween(homeScreen_mc, "x", Elastic.easeOut, -200, 10, 2, true);
}

public function gameScreen(event:MouseEvent):void
{
startGame();
}

public function howToPlayScreen(event:MouseEvent):void
{
gotoAndStop('howToPlayScreen');
trace("************ We are on HOW TO PLAY Screen ********************");
var howToPlayScreen:Tween = new Tween(howToPlayScreen_mc, "x", Elastic.easeOut, -200, 10, 2, true);
}

public function moreGamesScreen(event:MouseEvent):void
{
gotoAndStop('moreGamesScreen');
trace("************ We are on MORE GAMES Screen ********************");
var moreGamesScreen:Tween = new Tween(moreGamesScreen_mc, "x", Elastic.easeOut, -200, 10, 2, true);
}

public function thanksScreen(event:MouseEvent):void
{
gotoAndStop('thanksScreen');
trace("************ We are on THANKS Screen ********************");
var thanksScreen:Tween = new Tween(thanksScreen_mc, "x", Elastic.easeOut, -200, 10, 2, true);
}
//******************************************************************************

public function chooseAnswersGroup():void
{
gameScreen_mc.eagle_rb.group = radioGroup1;
gameScreen_mc.tails_rb.group = radioGroup1;
}

function startGame():void
{
stage.stageFocusRect = false;

gotoAndStop('gameScreen');
trace("************ We are on GAME Screen ********************");
var gameScreen:Tween = new Tween(gameScreen_mc, "x", Elastic.easeOut, -200, 10, 2, true);

trace(">> game starting...");

chooseAnswersGroup();
gameScreen_mc.eagle_rb.selected = true;

gameScreen_mc.eagle_rb.visible=true;
gameScreen_mc.tails_rb.visible=true;

gameScreen_mc.coinAnimToss_mc.visible = false;
gameScreen_mc.coin_mc.visible = false;
gameScreen_mc.coin_first.visible = true;

gameScreen_mc.points_txt.text="500";
gameScreen_mc.eagle_rb.label="Eagle";
gameScreen_mc.tails_rb.label="Tails";

gameScreen_mc.eagle_correct_mc.visible = false;
gameScreen_mc.eagle_wrong_mc.visible = false;
gameScreen_mc.tails_correct_mc.visible = false;
gameScreen_mc.tails_wrong_mc.visible = false;

gameScreen_mc.coinToss_btn.addEventListener(MouseEvent.CLICK, delayCheckAnswer);

points = 500;

gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = true;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}

public function delayCheckAnswer(event:MouseEvent):void
{
trace("delay going.....wait 1 sec");
setTimeout(checkAnswer, 1000);
gameScreen_mc.coin_mc.visible = false;
gameScreen_mc.coin_first.visible = false;
gameScreen_mc.coinAnimToss_mc.visible = true;
gameScreen_mc.coinAnimToss_mc.gotoAndPlay('playTossCoinAnimation');
}

function checkAnswer():void
{
gameScreen_mc.coin_mc.visible = true;
gameScreen_mc.coinAnimToss_mc.visible = false;
gameScreen_mc.coin_first.visible = false;

randomNumber=Math.random();//generate random number
trace("Random number: " + randomNumber);

if (randomNumber < 0.5)
{
gameScreen_mc.coin_mc.gotoAndPlay("eagle");
}
else
{
gameScreen_mc.coin_mc.gotoAndPlay("tails");
}
if (radioGroup1.selection.label == "Eagle" && randomNumber < 0.5)
{
gameScreen_mc.eagle_correct_mc.visible = true;//eagle pic correct - visible
gameScreen_mc.eagle_correct_mc.gotoAndPlay('correctPic');//plaing correct or wrong pic animation
gameScreen_mc.eagle_wrong_mc.visible = false;//eagle pic wrong - invisible
gameScreen_mc.tails_correct_mc.visible = false;//tails pic correct - invisible
gameScreen_mc.tails_wrong_mc.visible = false;//tails pic correct - invisible
points+=100;//added or deleted 100 points, depends of user guessed or not
gameScreen_mc.points_txt.text = String(points);//changing type(from number to string) and showing user points
gameScreen_mc.add100_mc.gotoAndPlay("add100");//animation for 'added +100 points' or 'deleted -100 points'
playSound(theCorrectSound);//play sound
trace("Eagle - correct");
trace("Player points: " + points);
trace("+++++++++++++++++++++++++++++++++++++++++++++++++");
}
else if (radioGroup1.selection.label == "Eagle" && randomNumber > 0.5)
{
gameScreen_mc.eagle_correct_mc.visible = false;
gameScreen_mc.eagle_wrong_mc.visible = true;
gameScreen_mc.eagle_wrong_mc.gotoAndPlay(’wrongPic’);
gameScreen_mc.tails_correct_mc.visible = false;
gameScreen_mc.tails_wrong_mc.visible = false;
points-=100;
gameScreen_mc.points_txt.text = String(points);
gameScreen_mc.del100_mc.gotoAndPlay(”del100″);
playSound(theWrongSound);
trace(”Eagle - wrong”);
trace(”Player points: ” + points);
trace(”+++++++++++++++++++++++++++++++++++++++++++++++++”);
}
else if (radioGroup1.selection.label == “Tails” && randomNumber > 0.5)
{
gameScreen_mc.eagle_correct_mc.visible = false;
gameScreen_mc.eagle_wrong_mc.visible = false;
gameScreen_mc.tails_correct_mc.visible = true;
gameScreen_mc.tails_correct_mc.gotoAndPlay(’correctPic’);
gameScreen_mc.tails_wrong_mc.visible = false;
points+=100;
gameScreen_mc.points_txt.text=String(points);
gameScreen_mc.add100_mc.gotoAndPlay(”add100″);
playSound(theCorrectSound);
trace(”Tails - correct”);
trace(”Player points: ” + points);
trace(”+++++++++++++++++++++++++++++++++++++++++++++++++”);
}
else
{
gameScreen_mc.eagle_correct_mc.visible = false;
gameScreen_mc.eagle_wrong_mc.visible = false;
gameScreen_mc.tails_correct_mc.visible = false;
gameScreen_mc.tails_wrong_mc.visible = true;
gameScreen_mc.tails_wrong_mc.gotoAndPlay(’wrongPic’);
points-=100;
gameScreen_mc.points_txt.text = String(points);
gameScreen_mc.del100_mc.gotoAndPlay(”del100″);
playSound(theWrongSound);
trace(”Tails - wrong”);
trace(”Player points: ” + points);
trace(”+++++++++++++++++++++++++++++++++++++++++++++++++”);
}

if (points == 100)
{
gameScreen_mc.earn100.visible = true;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 200)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = true;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 300)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = true;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 400)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = true;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 500)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = true;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 600)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = true;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 700)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = true;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 800)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = true;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = false;
}
if (points == 900)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = true;
gameScreen_mc.earn1000.visible = false;
}
if (points == 1000)
{
gameScreen_mc.earn100.visible = false;
gameScreen_mc.earn200.visible = false;
gameScreen_mc.earn300.visible = false;
gameScreen_mc.earn400.visible = false;
gameScreen_mc.earn500.visible = false;
gameScreen_mc.earn600.visible = false;
gameScreen_mc.earn700.visible = false;
gameScreen_mc.earn800.visible = false;
gameScreen_mc.earn900.visible = false;
gameScreen_mc.earn1000.visible = true;
}

if (points == 1000 || points == 0)
{
gameResult();
}

}

function gameResult():void
{
if (points == 1000)
{
gotoAndStop(’finalScreen’);
trace(”************ We are on FINAL Screen ********************”);
finalScreen_mc.message_txt.text = “You win 1000 points!”;
trace(”RESULT: win 1000″);
}
else if (points == 0)
{
gotoAndStop(’finalScreen’);
trace(”************ We are on FINAL Screen ********************”);
finalScreen_mc.message_txt.text = “You are lost your points!”;
trace(”RESULT: lost”);
}

finalScreen_mc.playAgain_btn.addEventListener(MouseEvent.CLICK, playAgain);
finalScreen_mc.homeBtn.addEventListener(MouseEvent.CLICK, goToHomeScreen);
}

function playAgain(event:MouseEvent):void
{
startGame();
}

function goToHomeScreen(event:MouseEvent):void
{
gameMenu();
}

public function playSound(soundObject:Object) {
var soundChannel:SoundChannel = soundObject.play();
}
}
}

Source:
Coin Toss

Guess Number game

Please enjoy with guess number game. Here you can find full source files for this game.

gn1

gn2


package {

import flash.events.*;
import flash.display.*;
import flash.text.TextField;

public class GuessNumber extends MovieClip
{
var guessNumber:Number;
var points:Number = 0;
var level:Number = 1;
var lastGuessNumber:Number = 5;

//constructor
public function GuessNumber()
{
generateNumber();
}

public function generateNumber(e:Event = null):void
{
gotoAndStop('gameScreen');
trace("****** Welcome Screen *********");
pointsView.text = "0";
levelView.text = "1";
addEventListener(Event.ADDED_TO_STAGE, startGuess);
startGuess();
howToPlay_mc.visible = false;
moreGames_mc.visible = false;
thanks_mc.visible = false;
howToPlayBtn.addEventListener(MouseEvent.CLICK, howToPlayScreen);
moreGamesBtn.addEventListener(MouseEvent.CLICK, moreGamesScreen);
thanksBtn.addEventListener(MouseEvent.CLICK, thanksScreen);
}

public function howToPlayScreen(event:MouseEvent):void
{
howToPlay_mc.visible = true;
trace("Open 'How to play screen'");
howToPlay_mc.closeBtn.addEventListener(MouseEvent.CLICK, closeHowToPlayScreen);
}
public function moreGamesScreen(event:MouseEvent):void
{
moreGames_mc.visible = true;
trace("Open 'More games screen'");
moreGames_mc.closeBtn.addEventListener(MouseEvent.CLICK, closeMoreGamesScreen);
}
public function thanksScreen(event:MouseEvent):void
{
thanks_mc.visible = true;
trace("Open 'Thanks screen'");
thanks_mc.closeBtn.addEventListener(MouseEvent.CLICK, closeThanksScreen);
}
public function closeHowToPlayScreen(event:MouseEvent):void
{
howToPlay_mc.visible = false;
trace("Close 'How to play screen'");
}
public function closeMoreGamesScreen(event:MouseEvent):void
{
moreGames_mc.visible = false;
trace("Close 'More games screen'");
}
public function closeThanksScreen(event:MouseEvent):void
{
thanks_mc.visible = false;
trace("Close 'How to play screen'");
}

public function startGuess(e:Event = null):void
{
//lastGuessNumber = 5;
trace("**** Starting Guess ****");
guessBtn.enabled = true;
guessBtn.visible = true;
nextLevelBtn.enabled = false;
nextLevelBtn.visible = false;
levelNumbers.text = "Guessed number betwen 1 and " + lastGuessNumber;
trace("Guessed number beetween 1 and " + lastGuessNumber);
yourGuessText.text = "";
levelView.text = String(level);
trace("Now Level: " + level);
pointsView.text = String(points);
trace("Player Points: " + points);

guessNumber=Math.ceil(Math.random()*lastGuessNumber);
trace("Guessed number: " + guessNumber);

removeEventListener(Event.ADDED_TO_STAGE,startGuess);
guessBtn.addEventListener(MouseEvent.CLICK,checkingYourGuess);
}

public function checkingYourGuess(e:MouseEvent):void
{
if (yourGuessText.length == 0)
{
trace("need enter something");
outputText.text="please enter a number beetween 1 and " + lastGuessNumber;
return;
}

if (guessNumber == Number(yourGuessText.text))
{
outputText.text = "You are GUESS!!!";
trace("Guess!");
points += 100;
trace("Player earn: " + points + " points!");
trace("+++++++++++++++++++++++++");
trace("go to the next level?");
nextLevelBtn.visible = true;
guessBtn.visible = false;
winGame();
}
else if (guessNumber > Number(yourGuessText.text))
{
points -= 20;
pointsView.text = String(points);
trace("-20 points, need MORE");
outputText.text="need MORE, try again please";
}
else if (guessNumber < Number(yourGuessText.text) && (Number(yourGuessText.text)<= lastGuessNumber))
{
points -= 20;
pointsView.text = String(points);
trace("-20 points, need LESS");
outputText.text="need LESS, try again please";
}
else if (Number(yourGuessText.text) > lastGuessNumber)
{
outputText.text = “enter number from 1 to ” + lastGuessNumber;
trace(”enter number from 1 to ” + lastGuessNumber);
}
}

public function winGame():void
{
pointsView.text = String(points);
level += 1;
if (level == 4)
{
youAreWinner();
trace(”You are winner!!!!!”);
pointsView.text = String(points);
trace(”Player earn: ” + points + ” points.” );
level = 1;
points = 0;
lastGuessNumber = 5;
}
else{lastGuessNumber += 10;}

nextLevelBtn.enabled=true;
guessBtn.enabled=false;
nextLevelBtn.addEventListener(MouseEvent.CLICK, playAgain);
}

public function playAgain(event:MouseEvent):void
{
trace(”yes”);
outputText.text = “”;
startGuess();
}

public function youAreWinner():void
{
gotoAndStop(’finishScreen’);
nextLevelBtn.visible = false;
guessBtn.visible = false;
playAgainBtn.addEventListener(MouseEvent.CLICK, generateNumber);
}

}

}

Source:
Guess Number

Font Embedding

As usual in flash games developers use special fonts. This fonts looks cool and exciting but exist one problem. A lot of users don’t has this fonts on their PC. And when they play in game they see not cool font and arial or something else what exist in their font library. So the main goal of this post to show cool font for game and any user who will use this game will see your cool and exciting font(even if player don’t have this font on his PC).

So open Flash IDE and create dynamic font.
e21

In properties must be like on this pic:
e1

In library create new font and on property must be like on this pic:
e3

Now need create .as file with next code:
e5

You can copy paste this code:

package
{
import flash.display.MovieClip;

import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.Font;

public class EmbedText extends MovieClip
{
public function EmbedText()
{
var myNumber:Number = 5;
var fooFont:Font = new foo();
var format:TextFormat = new TextFormat();
format.font=fooFont.fontName;
format.color=0x333333;
//format.size = 100;
//levelNumbers.height += 100;
levelNumbers.embedFonts=true;
levelNumbers.autoSize = TextFieldAutoSize.CENTER;
levelNumbers.antiAliasType=AntiAliasType.ADVANCED;
levelNumbers.defaultTextFormat = format;
levelNumbers.text = String(myNumber);
}
}
}

Don’t forgot to add class name to your main .fla document:
e4

Source file you can find on the end of this post.
So now every user will see your cool font.
Enjoy Flashing:)

Source:
Font Embedding

Mobile video for Flash Player 10.1

f_f_magazine_9_ok

You can download Sources and pdf.

  • Delivering video for Flash Player 10.1 on mobile devices


  • Why the iPad Will Redefine Our View of RIAs

    Apple has finally released the magical and mythical Mac Tablet, affectionately named the iPad.


  • What Kind of Website Should I Make?

    Before you can sit down and start publishing your website, you need to have an idea in your mind of what you want to achieve.


  • Project Organization Best Practices

    Planning and organization of a project may seem like too much trouble at first, but it can often help ensure the success of the project.


  • Dive into OSMF-Part One

    Due to the exponential growth of video during the last few years, a huge myriad of video players and video based applications were developed.


  • A Case for Streaming Media and the Cloud

    Guy Rosen writes a blog ‘Jack of all Clouds’ (http://www.jackofallclouds.com) where he has been tracking via random sampling the hosting providers of the top 500,000 websites.


  • Flex and Air

    Want to write a stand-alone program but don’t want to learn Visual Basic or Cocoa?


  • Understanding Flex 4 components

    In this article you’ll learn about the underlying foundation of the Spark component architecture in Flex 4. Most important, you’ll learn key facets that are specific to the Flex 4 Spark architecture.


  • Flex and Jabber

    The widely adopted open protocol for instant messaging XMPP (also called Jabber) is a de facto standard used in various instant messaging system, the aim of the article is to show up how much is easy and fast create a real time application using this protocol that relies over a restful architecture.


  • Dynamic Views and Mediators with PureMVC

    Intermediate-advanced knowledge of AS3 and OOP, working knowledge of Flex framework, and some working knowledge of PureMVC (this article isn’t a PureMVC tutorial).


  • Deeplinking your Flash and Flex applications with SWFAddress

    One of the common pitfalls of any RIA (Rich Internet Application) based on Flash or AJAX is that the state of the application changes but the URL usually stays the same.


  • Readers BUG – Readers Q&A section. Answers provided by Mark Doherty


  • New kid in town

    Flashcreed is a multinational project dedicated in creating the most complex FLASH components. Our main goal is to fulfill our clients’ wildest desires regarding versatility in design and performance. We strive to be the best at what we do and we always push ourselves to overcome any boundaries.


  • Talking Corona An interview with the Ansca Mobile cofounders

    Ansca Mobile‘s Corona SDK for iPhone was unveiled in the last issue of FFD Mag. Now – fresh off the heels of having their nostalgic Photoshop 1.0 app unveiled last month at Adobe’s Photoshop 20th anniversary event – cofounders Carlos Icaza and Walter Luh sit down to talk about why they should be
    the go-to choice for Flash developers looking to build for the iPhone.


Sounds for your game

agt-mp3-icon

Recently i thought about sound for my free flash games. I started search free and paid sounds. And after surfing the net i want share with sites what i find:

http://www.stockmusic.com/
http://www.premiumbeat.com/
http://www.newgrounds.com/
http://www.shockwave-sound.com/
http://promotingcrap.com/pages/unique-music/stockmusic/stockmusicarchive/
http://www.freesound.org/
http://www.flashkit.com/soundfx/
http://www.flashkit.com/loops/
http://www.soundsnap.com/
http://www.findsounds.com/types.html

Fonts for your game

When you think about creating your new game you must also think about fonts:) So where you can look to ready fonts? Or where you can create your own?

fonts

I find some sites with fonts on the net:
http://www.dafont.com/
http://www.ru.newfonts.net/
http://fontstruct.fontshop.com/