Flash CS4 Book and Training

April 14th, 2009



This Flash CS4 Book, Flash CS4 Professional Digital Classroom, is like having a personal instructor guiding readers through each lesson, while they work at their own pace. This book includes 13 self-paced lessons that let readers discover essential skills and explore new features and capabilities of Adobe Flash Professional. Every lesson is presented in full color with step-by-step instructions. Learning is reinforced with video tutorials and lesson files on a companion DVD that were developed by the same team of Adobe Certified Instructors and Flash experts who have created many of the official training titles for Adobe Systems. Each video tutorial is approximately five minutes long and demonstrates and explains the concepts and features covered in the lesson. This training package shows the basics of using the program, such as using layers and instances to build animation sequences, as well as advance features, such as using ActionScript to create interactive Web page components. Jam-packed with information, this book and DVD takes users from the basics through intermediate level topics and helps readers find the information they need in a clear, approachable manner.

Get it here.

From the Back Cover

You have a personal tutor in the Digital Classroom

If you want expert instruction that fits into your schedule, the Digital Classroom delivers. Adobe Certified Experts guide you through 15 lessons, helping you learn essential Flash CS4 Professional skills at your own speed. Full-color, step-by-step instructions in the book are enhanced with video tutorials on the DVD. With Digital Classroom, you have your own private instructor showing you the easiest way to learn Flash CS4.

* Create cool vector-based artwork and animation with Flash drawing tools
*

Use the new animation engine to easily create stunning, lightweight animation for online and CD/DVD ROM projects
*

Duplicate, save, and reuse animation sequences
*

Explore all-new tools for building 3D graphics and animation
*

Import graphics from Photoshop® and Illustrator®; add music or video for immersive multimedia creations
*

Control movie playback and create interactive controls with ActionScript®

Dan Uncategorized

Flash Helps: Create Text Field or Text Fields Dynamically

April 6th, 2009

Here’s a simple little example of creating actionscript 3 text fields dynamically.  It is also a great example of using functions to do all the dirty work for you.

In order for this to work you need to put a button component in the library.

This sample will create an input text field instance and a button instance.  When the user click on the button, it will create a new text field and set its x,y to random.

Here is the code:

import fl.controls.Button;
import flash.text.TextField;
import flash.text.TextFieldType;

//create a button
var myButton:Button = new Button();
myButton.label = "set text random x,y";
myButton.emphasized = true;
myButton.width = 150;
myButton.move(50, 100);
addChild(myButton);

var tf1:TextField = createTextField(10, 10, 400, 22, true);
tf1.type = TextFieldType.INPUT;

//create an input text field function
function createTextField(x:Number, y:Number, width:Number, height:Number, border:Boolean):TextField {
     var result:TextField = new TextField();
     result.x = x;
     result.y = y;
     result.width = width;
     result.height = height;
     result.background = true;
     result.border = border;
     addChild(result);
     return result;
}

//event that listens for the button to be clicked
myButton.addEventListener(MouseEvent.CLICK,setRandomXY);

//function that creates the new text field and sets the text
function setRandomXY(e:Event){
     var randomX = Math.random()*stage.width;
     var randomY = Math.random()*stage.height;
     var tf2:TextField = createTextField(randomX,randomY,50,20,false)
     tf2.type = TextFieldType.DYNAMIC;
     tf2.text = tf1.text;
}

Dan Flash Helps , , ,

Flash Helps: Tile Component

April 3rd, 2009

When Flash CS3 came out one of the new components was the Tile Component. The Tile Component in AS3 is similar to the Datagrid component in that it uses columns and rows to render data and images. The Tile Component can come in very useful in many instances of design and implementation.

Flash has a few examples of using the Tile Component in the helps. I’ve taken one of those examples and tweaked it a bit below. I put a text field on the stage with an instance name of myText and created a movieClip on the stage as well with the instance name of myMC.

The actionscript for using the Tile Component is as follows.  You’ll notice that it has some of the same properties as the DataGrid…like I mentioned.

import fl.controls.ScrollPolicy;
import fl.controls.TileList;
import fl.data.DataProvider;
import fl.controls.UIScrollBar;
import fl.events.ScrollEvent;
import fl.controls.ScrollBarDirection;

myText.text = “Select an Image”;

//add a bunch of images and labels
var dp:DataProvider = new DataProvider();
dp.addItem({label:”Image 1″, source:”http://www.helpexamples.com/flash/images/image1.jpg”});
dp.addItem({label:”Image 2″, source:”http://www.helpexamples.com/flash/images/image2.jpg”});
dp.addItem({label:”Image 3″, source:”http://www.helpexamples.com/flash/images/image3.jpg”});
dp.addItem({label:”Image 4″, source:”http://www.helpexamples.com/flash/images/image1.jpg”});
dp.addItem({label:”Image 5″, source:”http://www.helpexamples.com/flash/images/image2.jpg”});
dp.addItem({label:”Image 6″, source:”http://www.helpexamples.com/flash/images/image3.jpg”});
dp.addItem({label:”Image 7″, source:”http://www.helpexamples.com/flash/images/image1.jpg”});
dp.addItem({label:”Image 8″, source:”http://www.helpexamples.com/flash/images/image2.jpg”});
dp.addItem({label:”Image 9″, source:”http://www.helpexamples.com/flash/images/image3.jpg”});
dp.addItem({label:”Image 10″, source:”http://www.helpexamples.com/flash/images/image2.jpg”});
dp.addItem({label:”Image 11″, source:”http://www.helpexamples.com/flash/images/image2.jpg”});
dp.addItem({label:”Image 12″, source:”http://www.helpexamples.com/flash/images/image3.jpg”});

var myTileList:TileList = new TileList();
myTileList.dataProvider = dp;
myTileList.scrollPolicy = ScrollPolicy.ON;
myTileList.columnWidth = 100;
myTileList.rowHeight = 67;
myTileList.setSize(400,67);
myTileList.columnCount = 3;
myTileList.rowCount = 1;
myTileList.move(10, 300);
addChild(myTileList);

myTileList.addEventListener(MouseEvent.CLICK,itemClicked);
function itemClicked(e:Event):void {
//myText
myText.text = myTileList.selectedItem.label;
//myMC
var i =new Loader();
i.load(new URLRequest(myTileList.selectedItem.source));
myMC.addChild(i);
}

Here are the sample files:

tileComponent.swf
tileComponent.fla

Dan Flash Helps , ,

Flash Papervision 3D Sample > Rotating Image Block

April 2nd, 2009

Here’s a Flash AS3 (actionscript 3) Papervision 3D sample.  This sample loads data from an XML file that holds the location of the images.  It then puts them on a plane using the Papervision 3D classes and rotates them.

You need the Flash Player to view this video.

File:
PapervisionImageBlock.fla

Dan Uncategorized , ,

New Trailer

April 1st, 2009

One thing that we enjoy doing as a family is camping.  We had a Coleman tent-trailer for like 5-6 years and last year we finally decided that we had out grown it.  So we thought that we’d do our part in helping the economy and invest in a new(er) trailer for camping (and despite what Kyality might think…this does not make me a redneck :) )…OK, the economy wasn’t the real reason…we mostly just wanted to spend more time as a family doing things we loved.

Here are some photos:

Dan Family Stories, The Good Times are Over

Billboards in Vegas

March 9th, 2009
Comments Off

The billboard graphic I’ve been working on is now live in Vegas.  I think they turned out pretty good…lets hope the sales come a rolling on in.

Dan Portfolio

Flash Samples: Mini MP3 Music Player in AS3

February 20th, 2009
Comments Off

Here is a little Flash Sample in AS3 ( actionscript 3 ) I made that is a mp3 player.  It looks for a file variable called ‘myURL’ and loads that into the player.

Sample:
http://www.smithmediafusion.com/sotwPlayer.swf?myURL=TheStrokes1251.MP3

Files:
mini MP3 Player.fla

The code uses a flashvar which is the filename / URI of the mp3 file. It also utilizes other Flash Classes including the progressBar, Sound and SoundChannel Classes.

Code:

var myURL = root.loaderInfo.parameters.myURL;

playBtn.visible = true;
pauseBtn.visible = false;
pb.setSize(80.9, 14);
import fl.controls.Label;
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;
myLoadingTxt.text = “Press to play”;
myProgressBar.visible = false;
var sp:Sound;
var songControls:SoundChannel;
var positionPrev:Number;
var mypaused:Boolean;

var t:Timer = new Timer(1000);
t.addEventListener(TimerEvent.TIMER, timerHandler);
function onPlayBtnPress(event:MouseEvent):void {
pb.setSize(80.9, 7);
playBtn.visible = false;
pauseBtn.visible = true;

if(mypaused == true){
trace(”is paused true: “+myProgressBar.value*1000);

songControls=sp.play((myProgressBar.value*1000));
t.start();
mypaused = false;
}else{
myProgressBar.setProgress(0, myProgressBar.maximum);
sp = new Sound();

var req:URLRequest = new URLRequest(myURL);
sp.load(req);

var dataPath:String = myURL;
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest(dataPath));

songControls=sp.play();
songControls.addEventListener(Event.SOUND_COMPLETE,soundCompleteHandler);
trace(”songControls.position: “+songControls.position);
sp.addEventListener(Event.COMPLETE,updateTotalTime);

myProgressBar.visible = true;

myProgressBar.indeterminate = false;
myProgressBar.mode = ProgressBarMode.MANUAL;

addChild(myProgressBar);
var myLabel:Label = new Label();
myLabel.text = “”;
myLabel.autoSize = TextFieldAutoSize.LEFT;
myLabel.move(myProgressBar.x, myProgressBar.y + myProgressBar.height);
addChild(myLabel);

pb.source = loader;
addChild(pb);
myLoadingTxt.text = “Playing…”;

t.start();
}
}
function onPauseBtnPress(event:MouseEvent):void {
pb.setSize(80.9, 14);
playBtn.visible = true;
pauseBtn.visible = false;
trace(”pause”);

positionPrev=songControls.position;
songControls.stop();
mypaused=true;

t.stop();
}

function soundCompleteHandler(event:Event):void {
playBtn.visible = true;
pauseBtn.visible = false;
myProgressBar.visible = false;
mypaused = false;
trace(”done”);
myLoadingTxt.text = “Press to play”;
t.stop();

}

playBtn.addEventListener(MouseEvent.CLICK, onPlayBtnPress);
pauseBtn.addEventListener(MouseEvent.CLICK, onPauseBtnPress);

function updateTotalTime(e:Event):void {

myProgressBar.maximum = sp.length/1000;
trace(”sp.length: “+myProgressBar.maximum);
var minutes=Math.floor((sp.length/1000)/60);
var seconds=Math.floor((sp.length/1000)%60);
//myLoadingTxt.text=((minutes<10)?(”0″+minutes):minutes)+”:”+((seconds<10)?(”0″+seconds):seconds);
}

function timerHandler(event:TimerEvent):void {
myProgressBar.setProgress(myProgressBar.value + 1, myProgressBar.maximum);

}
function stopTimer(event:TimerEvent):void {
trace(”stopped”);
}

Dan Flash Helps

‘Arms out straight Daniel…’

January 29th, 2009

Douglas Hill Smith

1921 - 2009

Some of my earliest memories are of my grandpa. When we’d go over and visit them for Sunday dinner or to participate in some kind of service project grandpa would always greet us with a smile and then he’d say to me, “Arms out straight Daniel…OK, turn”, then we would both turn our arms as far as we could attempting to swivel them so the palms of our hands would be facing upwards. Both grandpa and I were born with a slight deformity of the bone in our elbows which prohibited the proper swiveling of the arm. It is called Congential Radioulnar Synostosis (CRS). My brother Andrew also was born with this inability.

As I would twist and turn my arms at grandpa’s request, I some how thought and got the impression that one day, if I tried hard enough and kept practicing as grandpa instructed, my arms would be “normal.” What grandpa was teaching me was a lesson I will never forget.

You might think that this physical limitation seems somewhat minor and insignificant in the grand scheme of life. I want to ask you to think of all the daily tasks you perform in every aspect and count how many times you need to turn your palms upwards to perform a simple task…it’s really quite amazing. Think about playing sports: baseball, using the glove to pick up a ground ball; opening a car door; taking change from a cashier. All of these tasks can be a challenge.

Every time grandpa and I met he would show me another trick he had learned that helped him overcome his simple daily challenges. We’d talk and smile and share ideas. Grandpa was teaching me and I felt a special bond knowing that he truly knew and felt what I was going through each and everyday.

Later in life when I was 19 years old, grandpa taught me one of the most important principles in life. We were serving side-by-side in a church related setting. The service required using our arms in away that grandpa and I were not able to perform as had been instructed. A man that was unaware of our challenges noticed grandpa and quickly came over to try and instruct him on the correct manner. Grandpa replied to him, “this is the best I can do.” The man smiled and returned to his place. During similar service and throughout my life when people have nudged me or approached me, I have replied with what grandpa taught me that day: “this is the best I can do”.

Grandpa always did his best in every area and aspect in his life no matter what the calling or position. Whether it be in family, church, community or business grandpa did his best. This principle and the lessons I have learned from him, along with the challenges that we shared with our arms, are some of the greatest blessings of my life.

Arms out straight grandpa…

—————————

Douglas Hill Smith

* Born 1921 Salt Lake City, Utah
* Baptized as a child at 8 years old; Aaronic Priesthood as a youth; Melchizedek Priesthood as a young man
* Married Barbara Bradshaw 1941; seven children
* Elders Quorum President, Bishop, Stake President, Regional Representative, Temple Sealer
* First Quorum of Seventy 1987-1989
* Second Quorum of Seventy 1989-1992
* Honorably released from Second Quorum 1992

The following biographical sketch is adapted from the “News of the Church: Elder Douglas H. Smith of the First Quorum of the Seventy” published in the Ensign for May 1987 on the occasion of Elder Smith’s call to the First Quorum of the Seventy.

When President Spencer W. Kimball called Barbara B. Smith to serve as general president of the Relief Society in October 1974, he turned to her husband and asked: “Will you be able to support your wife in this assignment?”

Douglas H. Smith replied, “Yes. She has supported me for over thirty years in the positions I’ve held, and I’ll certainly be happy to support her.” And he did.

With his recent call to the First Quorum of the Seventy, Elder Smith, sixty-five, now has need of his family’s support. And there is no doubt that he has it.

Ready support for family members seems to come naturally to the Smiths. All seven children now have families of their own, but they still live near each other and Elder Smith calls them almost every day. They have frequent family dinners. The monthly Smith Family News, including articles from each family, is “a wonderful way to keep in touch and to keep a history of what’s happening in the family,” Sister Smith says. Every summer they get together for a two- to three-day activity. And for the past five years, they’ve held an annual family conference for everyone twelve and older.

Support is extended to others as well. Elder Smith had lunch with his mother once a week as long as she lived. And for years the Smiths have had someone living with them: her father, her aunt (who lived with them for twenty years until she was in her nineties), a boy from Taiwan, a girl from South Africa, and several others needing a place to live for an extended period of time.

Douglas H. Smith was born 11 May 1921 in Salt Lake City to Virgil H. and Winifred Pearl Hill Smith. “Our lives were built around the Church,” he says, “And I’ve always had a strong testimony.” The closest he came to choosing another path came one Sunday when, as a deacon, he felt baseball’s beckoning call and decided to skip Sunday School. Sitting in the bleachers at the ball park, he heard a voice next to him:

“Great game, isn’t it?”

When he turned to reply, he was stunned to find his dad sitting there; the father had missed his son at church and had come to find him.

Elder Smith is well known in his family for his motto: “Choose you this day whom ye will serve; … but as for me and my house, we will serve the Lord” (Josh. 24:15). After marriage in the temple in 1941, he became an Aaronic Priesthood adviser, then elders quorum president, bishop’s counselor, and bishop. Later he served as high councilor, stake president’s counselor, stake president, and regional representative. Most recently he has served as a temple sealer and, with his wife, has team-taught the Gospel Doctrine class.

The day after graduating from the University of Utah in 1942, he got a job at Utah Home Fire Insurance Company. Sixteen years later, he was president of the company. And after another fourteen years, in 1972, he also became president of Beneficial Life Insurance Company, a position his father had held. He has also served as executive vice-president and general manager of Deseret Management Corporation and as chairman or member of the board of several other banking and insurance organizations. Active in community circles as well, he served for over nine years as chairman of the Salt Lake LDS Hospital Board and has also served with such organizations as Freedom Foundation of Valley Forge, American Cancer Society, and Boy Scouts of America.

“When President [Ezra Taft] Benson called me,” says Elder Smith, “I told him that a long time ago we made commitments to the Lord and we intend to keep them. Now we’re simply being asked if we meant it. The answer is yes.”
Elder Smith seved but two years of his five-year call in the First Council of the Seventy. On April 1, 1989, he was called into the newly organized Second Quorum of the Seventy where he faithfully completed the remainder of his calling. Elder Douglas Hill Smith was honorably released October 3, 1992.

Bibliography
“News of the Church: Elder Douglas H. Smith…,” Ensign May 1987 (principal source)
“The Sustaining of Church Officers,” Ensign, May 1989, p.17
“The Sustaining of Church Officers,” Ensign, Nov. 1992, p.20
2005 Church Almanac, 84

More Links:
http://www.ldschurchnews.com/articles/56542/Elder-Douglas-H-Smith-former-member-of-Seventy-passes-away-at-age-87.html

http://www.deseretnews.com/article/1,5143,705281545,00.html
http://www.ldschurchnews.com/articles/56601/Funeral-recalls-Douglas-H-Smith.html

Dan The Good Times are Over

Flash Helps: Flashvars in AS3

January 26th, 2009
Comments Off

Another new feature in AS3 ( actionscript 3 ) is the new method of calling and setting flashvars in your actionscript.  Back in actionscript 2, you just call them after setting them in your html code.  AS3 is different.  While there are a few methods to do this, the simplest way I’ve found is this:

//the name of my flashvar is myVar

myText.text = root.loaderInfo.parameters.myVar;

Then you can use the Flash AS3 global variable method I use here to set your flashvar in as3 as a global variable.

MyGlobal.myString =  root.loaderInfo.parameters.myVar;

Dan Flash Helps , , , ,

Flash Helps: AS3 Duplicate Movie Clip

January 19th, 2009

The easiest way to duplicate a movieClip in Flash AS3 that resides in your library is to first create your clip; then, in the library, right click on it and select Linkage…, and finally check the Export for ActionScript check box.

Here’s a step by step in case you got lost while doing the initial steps to duplicate your movieClip using AS3.

1. Create your Clip.  I just made a simple rectangle for an example with a motion tween.

duplicate clip AS3

2. Right Click your clip in the library and select “Linkage…” and then check “Export for ActionScript”.

What this does is make a class called “myMC” that we can now call using actionscript 3.

3.  Put the following actionscript on frame one of your main timeline:

addEventListener(MouseEvent.CLICK,makeABox);

var i:Number = 1; //i will be the total number of boxes

function makeABox(e:Event):void {
trace(”new box #” + i);
var newBox:myMC = new myMC();
addChild(newBox);
newBox.x = stage.mouseX;
newBox.y = stage.mouseY;
i++;
}

So what this all means is, we use addEventListener to listen for a mouse click.  When a mouse click is detected, it runs the function makeABox.  This function calls our new class “myMC” and adds a new child clip using addChild.  We set the X and Y of the clip by detecting the X and Y of the mouse on the stage.

Here’s a screen shot:

Flash AS3 helps duplicateMovie

Here are the source files, happy flash actionscript 3 - ing:

duplicateMovieAS3.fla

duplicateMovieAS3.swf

Dan Flash Helps

Watch President Obama’s Inauguration Online

January 16th, 2009
Comments Off

Flash on the Beach Discount Code

January 12th, 2009
Comments Off

I’ve just received word that John Davey who runs the Flash on The Beach Conference (http://www.flashonthebeach.com) is having a 48 hour recession madness ticket sale for FotB Miami which runs April 6-8 2009, South Beach, Miami.

Flash on the BeachFor the next 48 hours only - ending at midnight PST on Wednesday 14th January. A full 3 day pass is only $99 with the following code:

RSKNUTS1

From the FOTB site: Don’t think of FOTB as just another Flash conference. The Flash bit of the title is more of a mentality or vibe than just a software product. What we mean by that is that Flash is one of the coolest web tools around. It breeds a mentality and vibe that sets it apart.

Dan Announcements, Flash Gen.

Flash Help: AS3 Anchor Object to a Point

January 12th, 2009
Comments Off

Here’s a little helpful Flash AS3 sample that connects two object using Flash Actionscript 3.  Drag either of the objects (the green point or the cloud popUp) and they’ll stay connected.  Something like this might come in handy for a Flash map point sort of a thing or you could even motion tween the green point and have the popUP stay in the same place. This also uses the ENTER_FRAME eventListener method that calls graphics.lineTo and graphics.beginFill on frame enter.

Here’s the actionscript:

import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Graphics;

//drag the two objects on the stage popup and myPoint
popup.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
function mouseDown(event:MouseEvent):void {
popup.startDrag();
}

popup.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);
function mouseReleased(event:MouseEvent):void {
popup.stopDrag();
}

myPoint.addEventListener(MouseEvent.MOUSE_DOWN, pointMouseDown);
function pointMouseDown(event:MouseEvent):void {
myPoint.startDrag();
}

myPoint.addEventListener(MouseEvent.MOUSE_UP, pointMouseRelease);
function pointMouseRelease(event:MouseEvent):void {
myPoint.stopDrag();
}

//draw the connecting shage
var triangle_mc = new Shape();
addChild(triangle_mc);

popup.addEventListener(Event.ENTER_FRAME,popUPEnter);
function popUPEnter(evt:Event) {

triangle_mc.graphics.clear();
triangle_mc.graphics.beginFill(0xFFFFFF,100);
triangle_mc.graphics.lineStyle(4,0xFFFFFF,100);
triangle_mc.graphics.moveTo(myPoint.x,myPoint.y);

triangle_mc.graphics.lineTo(myPoint.x,myPoint.y);

if (popup.y<myPoint.y) {

triangle_mc.graphics.lineTo((popup.x),(popup.y+40));
triangle_mc.graphics.lineTo((popup.x),(popup.y+80));
triangle_mc.graphics.endFill();
}
if (popup.y>myPoint.y) {

triangle_mc.graphics.lineTo((popup.x),(popup.y));
triangle_mc.graphics.lineTo((popup.x),(popup.y)+30);
triangle_mc.graphics.endFill();
}
}

Here are the source files:
anchorTest - AS3.fla
anchorTest - AS3.swf

Dan Flash Helps

Flash Helps: onEnterFrame in AS3 is Event.ENTER_FRAME

January 9th, 2009
Comments Off

I have many fond memories of onEnterFrame in actionscript 2…so many I that I really don’t recall. I’d slap my movieClip instance on the stage and put onEnterFrame on there and I could call the same actionscript over and over again all day long.

With object oriented programing and actionscript 3 onEnterFrame is now Event.ENTER_FRAME.  So it essensitially does the same thing.  Since it is an event it is located in the Event class. Here’s a little snippet:

myMC.addEventListener(Event.ENTER_FRAME,myMCEnterFrame);
function myMCEnterFrame(evt:Event){

trace(”this is myMC”); //traces ‘this is myMC’   over and over

};

Pretty simple and straight forward.

Dan Flash Helps

Royal Bliss Life In-Between

January 8th, 2009

Life In-Between is the latest CD from Royal Bliss set to be release January 13th.  Having close ties to Royal Bliss, I was privileged  enough to have listened to the new CD before its release, Life In-Between.  Here’s my take: Solid. It’s the best Royal Bliss CD to date. These guys are really talented and have come a long way since back in 1997 when Bliss played their first show in the basement of DV8 and now they are releasing Life In-Between.  Congrats boys!

I strongly suggest that you get your own copy of Life In-Between by Royal Bliss.  You can get it online at Amazon Here.

Royal Bliss - Life In-Between

Royal Bliss is modern rock with equal parts beauty and tragedy. The band has already been through enough to justify their own VH1 Behind The Music episode complete with addiction, near death experiences, car crashes, and lawsuits. The elements of life lie in the process and the adventure, this album is the result of that journey, a place where tragedy and beauty can exist side by side, where every emotion is valid and every emotion is needed. Such is the essence of Royal Bliss.

Dan Music, The Good Times are Over