In Digital Audio Principles by lynda.com, let commercial composer, sound designer, and recording engineer Dave Schroeder take you through the basics of digital audio production. In this digital audio production training course for beginners, you'll learn the principles of digital audio, which you can use whether you are producing music, podcasts, game sounds, or film sound effects. The author will teach you important techniques, and cover the essential hardware and software that you'll need for digital audio production.
For more information about the course, and to view a portion of it for free, visit the course details page. To access this entire 7-hour training course, you can sign up for a lynda.com membership. And as a special promotion, you can get free access for 7 days by signing up for a free 7-day trial pass. This trial pass gives you access to the entire lynda.com training library of over 1000 training courses.
Course Topics
Chapter 1: Sound and Digital Audio
Chapter 2: Digital Audio Workstations
Chapter 3: Microphones
Chapter 4: Cables and Connectors
Chapter 5: Audio Input/Output Devices
Chapter 6: Input Levels and Preamplifiers
Chapter 7: The Mixer
Chapter 8: Monitoring
Chapter 9: Computers and Audio
Chapter 10: Setting Up for Recording
Chapter 11: Digital Audio Software
Chapter 12: Common DAW Components
Chapter 13: Recording and Playback
Chapter 14: Editing
Chapter 15: Plug-ins
Chapter 16: MIDI
Chapter 17: Mixing
Chapter 18: Mastering
Chapter 19: Audio File Compression
Chapter 20: Voice Recording
Chapter 21: Digital Audio Debates
Would you like to access to this excellent digital audio production training course for beginners?
Pages
▼
Monday, December 26, 2011
Friday, December 23, 2011
Learn How to Make a Social Networking Website
Learn how to make a social networking website in this excellent video training course entitled Building Custom Social Networking Websites. Here, you'll get to know the best tools and practices for designing and creating Facebook-like social networking web sites customized for specific targeted audiences or needs.
What you will learn:
You'll also be introduced to the following tools for building these social networking websites: Ning, WordPress, Moodle, and Joomla.
To learn more about the course, start watching the video tutorials below:
Target Audience
Why Build Social Networking Sites
Options for Creating Your Own Network
Hosted Social Networking Solutions
Self-Hosting Your Own Site
Examples of Custom Social Networks
Groups
Activity Streams
Discussion Forums
Blogs
Photo & Video Uploads
Polls
Chat & Events
RSS Feeds
Apps
If you enjoyed these video tutorials on how to make a social networking site, and would like to view the rest of the course, you can sign up for a VTC Online University membership. For as little as $30 a month, you get unlimited access to the entire VTC training library of thousands of video tutorials.
About VTC
The Virtual Training Company (VTC) started in California's Silicon Valley in 1996, and is one of the leading online training providers in the web today. They've built up a library of more than 1000 video training courses, which you can access entirely for $30/month.
Here's what some of their satisfied customers have to say:
This site is basically going to save my semester. I will be using it beyond that though. What a great site. Worth every penny. Thank you so much for your product.
- Kevin
Geoff Blake performed superbly on introducing Acrobat forms: clear, well-organized and instructive on the basics of the process. Bravo! I would highly recommend this course to anyone searching for a basic introduction to Acrobat forms.
- Brad B.
Over the course of a few weeks, I received approximately 60 hours of on-line Project Management training from VTC. The training was for a Project Management certification exam and I took 3 courses PMBOK (a bootcamp like course), PMBOK Schedule and PMBOK Risk. The course really prepared me for the test. I particularly found the Schedule and Risk Bundles instructive in expanding my intuitive understanding of these overall processes. The video instructor did a great job of performing the training and her commentary and explanations were right on. Her melodic voice is easy to listen to - she motivates and encourages study. I passed the Project Management Certification on my first try after completing this course of study. Top qualities: Great Results, Personable, Good Value.
- Annemarie DeMarco
I joined on the 20th August 2010, and I'm most impressed. I need to learn Excel for my job and at 64 years old I never thought I would ever be able to conquer spreadsheets! I have been practicing along with your tutorials, and I can't believe how quickly I am picking it up. The online course is worth every penny and I will be recommending you and your team for the excellent service and content to anyone who will listen. Magic! By the way I'm not that great on a computer either so if I can do it, then it's a doodle for anyone else!
- Barbara Richards
What you will learn:
- The best tools and practices for designing and creating social networking websites
- How to design sites that encourage users to interact and communicate with on another and build friendships, trust, and community
- How to import content into a site from elsewhere on the Internet
- How to encourage users to contribute to the site
- How to earn revenue from your social networking website
You'll also be introduced to the following tools for building these social networking websites: Ning, WordPress, Moodle, and Joomla.
To learn more about the course, start watching the video tutorials below:
Course Introduction
What You Will Learn from the CourseTarget Audience
Why Build Social Networking Sites
What is a Social Network?
Definition of a Social NetworkOptions for Creating Your Own Network
Hosted Social Networking Solutions
Self-Hosting Your Own Site
Examples of Custom Social Networks
Elements of a Social Network
Users & ProfilesGroups
Activity Streams
Discussion Forums
Blogs
Photo & Video Uploads
Polls
Chat & Events
RSS Feeds
Apps
If you enjoyed these video tutorials on how to make a social networking site, and would like to view the rest of the course, you can sign up for a VTC Online University membership. For as little as $30 a month, you get unlimited access to the entire VTC training library of thousands of video tutorials.
About VTC
The Virtual Training Company (VTC) started in California's Silicon Valley in 1996, and is one of the leading online training providers in the web today. They've built up a library of more than 1000 video training courses, which you can access entirely for $30/month.
Here's what some of their satisfied customers have to say:
This site is basically going to save my semester. I will be using it beyond that though. What a great site. Worth every penny. Thank you so much for your product.
- Kevin
Geoff Blake performed superbly on introducing Acrobat forms: clear, well-organized and instructive on the basics of the process. Bravo! I would highly recommend this course to anyone searching for a basic introduction to Acrobat forms.
- Brad B.
Over the course of a few weeks, I received approximately 60 hours of on-line Project Management training from VTC. The training was for a Project Management certification exam and I took 3 courses PMBOK (a bootcamp like course), PMBOK Schedule and PMBOK Risk. The course really prepared me for the test. I particularly found the Schedule and Risk Bundles instructive in expanding my intuitive understanding of these overall processes. The video instructor did a great job of performing the training and her commentary and explanations were right on. Her melodic voice is easy to listen to - she motivates and encourages study. I passed the Project Management Certification on my first try after completing this course of study. Top qualities: Great Results, Personable, Good Value.
- Annemarie DeMarco
I joined on the 20th August 2010, and I'm most impressed. I need to learn Excel for my job and at 64 years old I never thought I would ever be able to conquer spreadsheets! I have been practicing along with your tutorials, and I can't believe how quickly I am picking it up. The online course is worth every penny and I will be recommending you and your team for the excellent service and content to anyone who will listen. Magic! By the way I'm not that great on a computer either so if I can do it, then it's a doodle for anyone else!
- Barbara Richards
Are you ready to be part of this community of satisfied learners?
[Become a VTC.com Member TODAY!]
Get complete access to ALL the VTC Online University courses for $30/month
[Become a VTC.com Member TODAY!]
Get complete access to ALL the VTC Online University courses for $30/month
Monday, December 19, 2011
How to mix audio - Audio mixing lessons and tutorials for beginners
How to mix audio - If you're new to audio mixing, and would like to learn more in order to improve your skills, then Audio Mixing Bootcamp by lynda.com is a great training course to help you reach your goals. These audio mixing lessons and tutorials are great for beginners and people who'd like to improve their music mixing skills. In this course, you'll learn things like how to optimize your listening environment; efficient ways to prepare and set up a mix; properly balancing your mix; best ways to apply EQ to the different elements in your mix; adding reverb, delay and modulation; the differences between amateur and pro-sounding mixes, and more! To learn more about the course, watch the free audio mixing video tutorials below or visit the course details page. As a special promotion, visitors of Tutorials 101 can get a free 7-day trial pass to get complete access to this course along with the entire lynda.com training library of over 1000 training courses.
Saturday, December 17, 2011
Adobe Premiere CS5 Tutorials for Beginners - How to Use Premiere CS5 Video Tutorials - Premiere PRO CS5
If you're interested in learning how to use Premiere CS5, then check out the video tutorials below. These Adobe Premiere CS5 tutorials for beginners are from Premiere Pro CS5 Essential Training - an excellent video training course from lynda.com. Here, you'll learn the fundamentals of this world-class video editing program, and along the way, you'll also learn how to use video to tell compelling stories. Topics include: Adding footage to the Timeline, Making overlay and insert edits, Playing a clip backwards, Understanding pixel aspect ratio and frame rate, Applying motion effects, Cutting video to music, Compositing with green screen and blend modes, Correcting color, Creating titles and lower thirds, Exporting sequences, and more! To learn more about the course, watch the free Premiere CS5 video tutorials below, or you can also visit the course details page. To get access to this entire 5-hour self-paced training course, visitors of Tutorials 101 can sign up for a free 7-day trial pass. You will not only get free and complete access to this course for 7 days, but you'll also get complete access to lynda.com's entire training library of over 1000 courses.
Friday, December 16, 2011
Photoshop CS5 Photography Tutorials for Photoshop CS5 Photographers - Watch Photoshop CS5 Tutorials for Photographers
How can we use Photoshop from a photographic perspective in order to create engaging and intriguing images? If you're looking for Photoshop CS5 Photography tutorials that will help answer that question, then you might be interested in Photoshop CS5 for Photographers by lynda.com. The high-quality Photoshop CS5 tutorials for photographers in this excellent training course were designed specifically with Photoshop CS5 Photographers in mind. Topics include: Calibrating a monitor; Setting up color and file handling preferences; Processing images in Camera Raw; Making selections and taking advantage of the Refine Edge feature; Masking and selective sharpening; Improving a photo using Content-Aware Fill and the Puppet Warp tool; Enhancing color, tone, and contrast with Levels; Improving underexposure and overexposure using blending; Burning and dodging techniques; Converting an image to black and white; Retouching essentials; Publishing images to the web, and more! Watch the free videos below to learn more about the course, or you can also visit the course details page. And as a special promotion, visitors of Tutorials 101 can get a free 7-day trial pass, which gives you access to this entire course along with all the other training courses by lynda.com.
Adobe Photoshop CS4 Online Training for Beginners - First 3 Chapters FREE
The VTC Online University is a great site that offers high-quality software video training. Check out their Adobe Photoshop CS4 Online Training for Beginners course. Scroll down to watch the first 3 chapters for free. Just click on the video links to launch the free video tutorials. Visit the course details page for more information about this Photoshop CS4 online training course for beginners. The entire course contains a total of 9 hours worth of excellent video tutorials. Sign up for a VTC.com membership in order to view the entire course.
Thursday, December 15, 2011
How to Repair Photos in Photoshop - Photo Restoration Tutorials
Learn how to repair photos in Photoshop from photo restoration expert, Janine Smith, in this self-paced online video training course entitled Photo Restoration with Photoshop from lynda.com. In this training course, the author demonstrates different photo restoration techniques by working on examples ranging from the basic to the more challenging. Watch the sample video tutorials below to learn more about the course. You can also sign-up for a free 7-day trial pass to get complete access to the entire lynda.com online training library of over 1000 video training courses
Tuesday, December 13, 2011
What is Online Marketing? - Online Marketing Training Course - Learn how to Market Online
What is online marketing? Learn the fundamentals of how to market online in this excellent online marketing training course by lynda.com. In Online Marketing Fundamentals, let Lorrie Thomas Ross take you through the process of how to create a successful online marketing campaign. This excellent training course is ideal for web marketers, web designers, business owners, and executives. Topics include: Working with web analytics software, Building a site map, Selecting a domain name and a web host, Planning for mobile, Conducting social media marketing, Developing an email marketing campaign, Reviewing online public relations, Understanding the difference between search engine marketing (SEM) and search engine optimization (SEO), and more! Visitors of Tutorials101 can access the entire course for free by signing up for a free 7-day trial. You can also learn more about the training course by watching the free videos below.
Wednesday, December 7, 2011
The AS3 'this' keyword and how to randomize the size of a MovieClip instance on the stage
In this lesson, we'll learn about the this keyword. But before I explain what the this keyword is, let's first recall that we can put some ActionScript code on keyframes in the main timeline. But we can also put some ActionScript code on the keyframes inside MovieClip symbols as well. If we place ActionScript code on the keyframes inside of MovieClip symbols, then it means that the code is inside the MovieClip symbol's timeline, instead of being on the main timeline.
It's important to take note of this, because the this keyword references whichever object the this keyword is placed in. Is it within the code in the main timeline, or is it within the code nested inside a MovieClip symbol instead? If we placed the this keyword within the code inside one of the keyframes in the main timeline, then the this keyword will refer to the main timeline. If the this keyword was placed inside the timeline of a MovieClip symbol, then the this keyword will refer to the instance of the MovieClip symbol instead (or instances, if there are more than one). So what this is, depends on where this is.
To hopefully make things a little more clear, let's create an example.
Step 1
Create a new Flash ActionScript 3.0 document.
Step 2
Select the first keyframe of the main timeline, then open up the Actions Panel.
Step 3
In the script pane, type:
Let's try to trace this to see what it will output. Basically, when we create this trace statement, it's like we are asking: what is this?
And in this example, the answer to that is: the main timeline. Since we selected the first keyframe of the main timeline when we added the code, this means that our code is on the main timeline. So in this example, this refers to the main timeline.
Step 4
Test the movie.
In the output window, you should see the message: [object MainTimeline]. So the message in the output window confirms that the this keyword in our example refers to the main timeline. It refers to the main timeline since the this keyword was placed in one of the frames of the main timeline. When using the this keyword, this refers to wherever this is.
Step 5
Now let's try placing the this keyword inside a MovieClip symbol instead. But first, go back to the actions panel and erase the trace statement that we placed on the main timeline so as not to make things confusing when we're trying to trace the MovieClip objects we're about to create.
Step 6
Next, let's create the symbol.
Using the oval tool, draw a circle on the stage and convert it into a MovieClip symbol named Circle.
Step 7
Then give the MovieClip instance an instance name.
Make sure that the instance on the stage is selected (do NOT double-click on it because that will bring you inside the MovieClip symbol's timeline). Once it's selected, go to the properties inspector and type circle1_mc in the instance name input field.
Step 8
Now, let's add some ActionScript inside the MovieClip symbol's timeline.
This time, you can double-click on the MovieClip instance on the stage in order to go inside the MovieClip symbol's timeline.
Step 9
Double-check that you are, in fact, inside the MovieClip symbol's timeline by looking at the edit bar. The edit bar should say Scene 1 > Circle.
Step 10
Once you've confirmed that you are inside the MovieClip symbol, add another layer on the timeline, and name it Actions.
Remember: this timeline belongs to the MovieClip symbol. We are not on the main timeline.
Step 11
Then select the first keyframe of the Actions layer, then go to the actions panel and type:
Here, we are not simply referencing this, but specifically, we are tracing its name. You can use the this keyword to access properties and methods of objects as well. Basically, in this example, our trace statement is trying to ask: what is the name of this object?
Since the statement that contains the this keyword is inside the MovieClip symbol's timeline, it's going to output circle1_mc in the output window. The this keyword references objects or instances that contain it. So the this keyword is going to refer to the specific instance of the MovieClip symbol on the stage, and not the symbol in the library. This is why it's going to output circle1_mc (which is the instance name), and not Circle (which is the symbol's name).
Step 12
Now let's go back to the main timeline by clicking on the scene 1 link.
Step 13
Once we are back on the main timeline, go to the library and drag another instance of the Circle symbol onto the stage. Give this one circle2_mc for its instance name. Since this is also an instance of the Circle symbol, it's also going to have the same trace statement inside it already. Whatever code you have inside the timeline of a MovieClip symbol will also be inside any of its instances that are on the stage. There is no need for us to add it again. So when we test the movie, Flash is also going to output the name of this second instance in the output window.
Step 14
Go ahead and test the movie.
You should see the names circle1_mc and circle2_mc displayed in the output window.
Why would we want to use the this keyword?
Sometimes, you might want to place some code inside a MovieClip symbol's timeline. That way, every single instance of the MovieClip symbol will have the same code inside it when you place it on the stage. This saves you some time, because you won't have to repeatedly type the same code over and over. You just have to put it inside the MovieClip symbol's timeline once, and then every instance of that MovieClip symbol will have the code already placed inside it. The this keyword lets us explicitly tell Flash that our code is meant for that specific instance that contains the this keyword.
Let's see this in action by adding more code to our example.
Step 15
Go back inside the Circle MovieClip's timeline by double-clicking any of the instances on the stage. Then select the first keyframe of the Actions layer and open up the Actions Panel.
Step 16
Remove the trace statement, and add these lines of code in its place:
Here, we've added some lines of code that will increase the size of each instance of the MovieClip symbol that we place on the stage. Basically, the code is saying: scale this to 3 times its original size. So when the Flash movie runs, the MovieClip instances on the stage will be 3 times larger.
Step 17
Go back to the main timeline, by clicking on the scene 1 link.
Step 18
From the library, add more instances of the Circle MovieClip symbol until you have ten instances on the stage.
Step 19
Test the movie.
You should see that each circle is now three times larger than its original size. Since we placed the code inside the MovieClip symbol's timeline, instead of the main timeline, then we only had to write those lines once, and each instance will have the same lines of code built-in. This is why every single instance of the Circle MovieClip became bigger.
Step 20
In this next step, we'll modify the code so that each instance of the Circle MovieClip will have a different, randomized size.
Go back to the Circle MovieClip symbol's timeline by double-clicking any of the instances on the stage. Then select the first keyframe of the Actions layer and open up the Actions Panel.
Step 21
In the script pane, replace the current code with this:
The first line of code creates a variable named nScale. And then to this variable, we are assigning the expression Math.random() * 3. What this does is it generates a random number that can be anywhere between 0 and 3. If you want Flash to choose from a higher range of values, then simply replace 3 with a higher value (but don't make it too high since we are going to use it to scale the size of the objects). Then once that random number is generated, the number is assigned to the scaleX and scaleY properties. This is going to happen for each instance of the Circle MovieClip that we have on the stage. So chances are, they'll each generate a different value, thus making them all have different sizes once the Flash movie runs.
Step 22
Test the movie and you should see your circle's all in different sizes. And since the values are generated randomly, you'll see different sizes every time you test the movie.
It's important to take note of this, because the this keyword references whichever object the this keyword is placed in. Is it within the code in the main timeline, or is it within the code nested inside a MovieClip symbol instead? If we placed the this keyword within the code inside one of the keyframes in the main timeline, then the this keyword will refer to the main timeline. If the this keyword was placed inside the timeline of a MovieClip symbol, then the this keyword will refer to the instance of the MovieClip symbol instead (or instances, if there are more than one). So what this is, depends on where this is.
To hopefully make things a little more clear, let's create an example.
Step 1
Create a new Flash ActionScript 3.0 document.
Step 2
Select the first keyframe of the main timeline, then open up the Actions Panel.
Step 3
In the script pane, type:
trace(this);
Let's try to trace this to see what it will output. Basically, when we create this trace statement, it's like we are asking: what is this?
And in this example, the answer to that is: the main timeline. Since we selected the first keyframe of the main timeline when we added the code, this means that our code is on the main timeline. So in this example, this refers to the main timeline.
Step 4
Test the movie.
In the output window, you should see the message: [object MainTimeline]. So the message in the output window confirms that the this keyword in our example refers to the main timeline. It refers to the main timeline since the this keyword was placed in one of the frames of the main timeline. When using the this keyword, this refers to wherever this is.
Step 5
Now let's try placing the this keyword inside a MovieClip symbol instead. But first, go back to the actions panel and erase the trace statement that we placed on the main timeline so as not to make things confusing when we're trying to trace the MovieClip objects we're about to create.
Step 6
Next, let's create the symbol.
Using the oval tool, draw a circle on the stage and convert it into a MovieClip symbol named Circle.
Step 7
Then give the MovieClip instance an instance name.
Make sure that the instance on the stage is selected (do NOT double-click on it because that will bring you inside the MovieClip symbol's timeline). Once it's selected, go to the properties inspector and type circle1_mc in the instance name input field.
Step 8
Now, let's add some ActionScript inside the MovieClip symbol's timeline.
This time, you can double-click on the MovieClip instance on the stage in order to go inside the MovieClip symbol's timeline.
Step 9
Double-check that you are, in fact, inside the MovieClip symbol's timeline by looking at the edit bar. The edit bar should say Scene 1 > Circle.
Step 10
Once you've confirmed that you are inside the MovieClip symbol, add another layer on the timeline, and name it Actions.
Remember: this timeline belongs to the MovieClip symbol. We are not on the main timeline.
Step 11
Then select the first keyframe of the Actions layer, then go to the actions panel and type:
trace(this.name);
Here, we are not simply referencing this, but specifically, we are tracing its name. You can use the this keyword to access properties and methods of objects as well. Basically, in this example, our trace statement is trying to ask: what is the name of this object?
Since the statement that contains the this keyword is inside the MovieClip symbol's timeline, it's going to output circle1_mc in the output window. The this keyword references objects or instances that contain it. So the this keyword is going to refer to the specific instance of the MovieClip symbol on the stage, and not the symbol in the library. This is why it's going to output circle1_mc (which is the instance name), and not Circle (which is the symbol's name).
Step 12
Now let's go back to the main timeline by clicking on the scene 1 link.
Step 13
Once we are back on the main timeline, go to the library and drag another instance of the Circle symbol onto the stage. Give this one circle2_mc for its instance name. Since this is also an instance of the Circle symbol, it's also going to have the same trace statement inside it already. Whatever code you have inside the timeline of a MovieClip symbol will also be inside any of its instances that are on the stage. There is no need for us to add it again. So when we test the movie, Flash is also going to output the name of this second instance in the output window.
Step 14
Go ahead and test the movie.
You should see the names circle1_mc and circle2_mc displayed in the output window.
Why would we want to use the this keyword?
Sometimes, you might want to place some code inside a MovieClip symbol's timeline. That way, every single instance of the MovieClip symbol will have the same code inside it when you place it on the stage. This saves you some time, because you won't have to repeatedly type the same code over and over. You just have to put it inside the MovieClip symbol's timeline once, and then every instance of that MovieClip symbol will have the code already placed inside it. The this keyword lets us explicitly tell Flash that our code is meant for that specific instance that contains the this keyword.
Let's see this in action by adding more code to our example.
Step 15
Go back inside the Circle MovieClip's timeline by double-clicking any of the instances on the stage. Then select the first keyframe of the Actions layer and open up the Actions Panel.
Step 16
Remove the trace statement, and add these lines of code in its place:
this.scaleX = 3;
this.scaleY = 3;
Here, we've added some lines of code that will increase the size of each instance of the MovieClip symbol that we place on the stage. Basically, the code is saying: scale this to 3 times its original size. So when the Flash movie runs, the MovieClip instances on the stage will be 3 times larger.
Step 17
Go back to the main timeline, by clicking on the scene 1 link.
Step 18
From the library, add more instances of the Circle MovieClip symbol until you have ten instances on the stage.
Step 19
Test the movie.
You should see that each circle is now three times larger than its original size. Since we placed the code inside the MovieClip symbol's timeline, instead of the main timeline, then we only had to write those lines once, and each instance will have the same lines of code built-in. This is why every single instance of the Circle MovieClip became bigger.
Step 20
In this next step, we'll modify the code so that each instance of the Circle MovieClip will have a different, randomized size.
Go back to the Circle MovieClip symbol's timeline by double-clicking any of the instances on the stage. Then select the first keyframe of the Actions layer and open up the Actions Panel.
Step 21
In the script pane, replace the current code with this:
var nScale:Number = Math.random() * 3;
this.scaleX = nScale;
this.scaleY = nScale;
The first line of code creates a variable named nScale. And then to this variable, we are assigning the expression Math.random() * 3. What this does is it generates a random number that can be anywhere between 0 and 3. If you want Flash to choose from a higher range of values, then simply replace 3 with a higher value (but don't make it too high since we are going to use it to scale the size of the objects). Then once that random number is generated, the number is assigned to the scaleX and scaleY properties. This is going to happen for each instance of the Circle MovieClip that we have on the stage. So chances are, they'll each generate a different value, thus making them all have different sizes once the Flash movie runs.
Step 22
Test the movie and you should see your circle's all in different sizes. And since the values are generated randomly, you'll see different sizes every time you test the movie.
Wednesday, November 30, 2011
Expressions and Operators in ActionScript 3
An expression is something that computes or evaluates into a single value. In a very simple form, a reference to a variable is already an expression. For example:
Here, the variable quantity evaluates to a value of 5.
An expression can also be made up of multiple values that are manipulated in some kind of operation. For example:
Here, we have two values: 10 and 5. The values in this expression are referred to as operands. These operands are going to be added together, as signified by the plus symbol. The plus symbol is referred to as the operator in this expression. Operators are special characters that are used to perform operations between values or operands. And once the operation in this example is complete, the expression evaluates to a value of 15.
Let's take a look at some of the operators you can use in ActionScript 3.
Arithmetic Operators
Examples:
The plus, minus, multiply, and divide operators are pretty self-explanatory. As for the Modulo operator, this will return the remainder from a division operation.
Example:
7 divided by 2 is equal to 3 remainder 1. A modulo operation will return the remainder, so 7 % 2 will return 1.
When performing an arithmetic operation on expressions that have more than two different operators, use parentheses to group the operands and operators that you would like to compute for first.
Example:
In this example, the operations within the parentheses will be computed first, and then the results will be divided.
Without the parentheses, the division and multiplication operations will be calculated first, followed by the addition operation, resulting in a different value.
So the following expression, which doesn't make use of parentheses, will actually have a different outcome even though it uses the same values:
Assignment Operators
Let's take a look at the Assignment operator first. The Assignment operator is represented by the equals sign (=). It can be used to assign a value to an operand.
Example:
In this example, the Assignment operator is used to assign a value of 10 to the nScore variable. The operand to the right of the equals sign is assigned to the operand to the left of the equals sign.
The other assignment operators (Addition Assignment, Subtraction Assignment, Multiplication Assignment, and Division Assignment) allow you to write shorthand versions of arithmetic and assignment operations combined.
Example:
In this example, nScore += 5 is just the shorthand version of writing nScore = nScore + 5. This means that you are adding 5 to whatever the current value of nScore is.
Comparison Operators
Comparison operators are used to compare values. An expressions that uses comparison operators will evaluate to either true or false.
Examples:
Logical Operators
The And and Or logical operators allow you to combine two or more sets of comparison expressions.
If you use the And operator, the comparison expressions you are combining ALL have to be true in order for the entire expression to return a value of true.
Examples:
If you use the Or operator, only one of the expressions needs to be true in order to return a value of true.
Example:
The Not Operator
The Not operator expresses the opposite of a Boolean.
Example:
The value of compare is false. In the trace statement however, the variable is being negated by the Not operator, so the trace statement is actually going to output the opposite of false, which is true.
The Concatenation Operator
The Concatenation operator, which also uses the plus (+) sign, allows you to concatenate or combine String values.
Example:
In this example, the Concatenation operator combines the String values together. In between sFName and sLName are two quotation marks with nothing but a single empty space inside. This is an empty string that just adds a space in between the other two String values.
The Increment and Decrement Operators
The Increment operator increments a numeric value by one (plus 1). The Decrement operator decrements a numeric value by one (minus 1).
Example:
In this example, nScore++ is the same as writing nScore = nScore + 1 or nScore += 1.
NOTE: If you try to trace nScore++ immediately like so:
trace(++nScore);
And that concludes this lesson on expressions and operators in ActionScript 3.
var quantity:Number = 5;
trace(quantity);
Here, the variable quantity evaluates to a value of 5.
An expression can also be made up of multiple values that are manipulated in some kind of operation. For example:
trace(10 + 5);
Here, we have two values: 10 and 5. The values in this expression are referred to as operands. These operands are going to be added together, as signified by the plus symbol. The plus symbol is referred to as the operator in this expression. Operators are special characters that are used to perform operations between values or operands. And once the operation in this example is complete, the expression evaluates to a value of 15.
Let's take a look at some of the operators you can use in ActionScript 3.
Arithmetic Operators
- Plus (+)
- Minus (-)
- Multiply (*)
- Divide (/)
- Modulo (%)
Examples:
trace(10 + 5);
trace(5 - 3);
trace(2 * 2);
trace(8 / 4);
The plus, minus, multiply, and divide operators are pretty self-explanatory. As for the Modulo operator, this will return the remainder from a division operation.
Example:
trace(7 % 2);
7 divided by 2 is equal to 3 remainder 1. A modulo operation will return the remainder, so 7 % 2 will return 1.
When performing an arithmetic operation on expressions that have more than two different operators, use parentheses to group the operands and operators that you would like to compute for first.
Example:
var nCompute:Number = (4 + 20) / (3 * 2);
trace(nCompute);
In this example, the operations within the parentheses will be computed first, and then the results will be divided.
Without the parentheses, the division and multiplication operations will be calculated first, followed by the addition operation, resulting in a different value.
So the following expression, which doesn't make use of parentheses, will actually have a different outcome even though it uses the same values:
var nCompute2:Number = 4 + 20 / 3 * 2;
trace(nCompute2);
Assignment Operators
- Assignment (=)
- Addition Assignment (+=)
- Subtraction Assignment (-=)
- Multiplication Assignment (*=)
- Division Assignment (/=)
Let's take a look at the Assignment operator first. The Assignment operator is represented by the equals sign (=). It can be used to assign a value to an operand.
Example:
var nScore:Number = 10;
In this example, the Assignment operator is used to assign a value of 10 to the nScore variable. The operand to the right of the equals sign is assigned to the operand to the left of the equals sign.
The other assignment operators (Addition Assignment, Subtraction Assignment, Multiplication Assignment, and Division Assignment) allow you to write shorthand versions of arithmetic and assignment operations combined.
Example:
var nScore:Number = 10;
trace(nScore += 5);
// Outputs a value of 15
In this example, nScore += 5 is just the shorthand version of writing nScore = nScore + 5. This means that you are adding 5 to whatever the current value of nScore is.
Comparison Operators
- Equality (==)
- Inequality (!=)
- Greater than (>)
- Less than (<)
- Greater than or equal (>=)
- Less than or equal (<=)
Comparison operators are used to compare values. An expressions that uses comparison operators will evaluate to either true or false.
Examples:
trace(4 == 4);
// This expression tests if 4 is equal to 4.
// This evaluates to true since 4 really is equal to 4.
trace(6 != 6);
// This expression tests if 6 is NOT equal to 6.
// This evaluates to false since the two operands
// have the same value and are therefore equal.
trace(10 > 7);
// This expression tests if 10 is greater than 7.
// Since 10 really is greater than 7,
// then this expression evaluates to true.
Logical Operators
- And (&&)
- Or (||)
The And and Or logical operators allow you to combine two or more sets of comparison expressions.
If you use the And operator, the comparison expressions you are combining ALL have to be true in order for the entire expression to return a value of true.
Examples:
trace(4 == 4 && 5 == 5);
// This evaluates to true since both comparison expressions are true.
// 4 is equal to 4 AND 5 is equal to 5.
trace(4 == 4 && 5 == 6);
// This evaluates to false. Even if 4 is equal to 4,
// the second comparison expression is false;
// So the whole thing becomes false.
If you use the Or operator, only one of the expressions needs to be true in order to return a value of true.
Example:
trace(4 == 4 || 5 == 6);
// This still evaluates to true.
// Even if the second comparison expression is false,
// the first one is still true, so the whole expression
// evaluates to true.
The Not Operator
- Not (!)
The Not operator expresses the opposite of a Boolean.
Example:
var compare:Boolean = 10 < 5;
// This evaluates to false since 10 is, in fact,
// not less than 5.
trace(!compare);
// This will output true.
The value of compare is false. In the trace statement however, the variable is being negated by the Not operator, so the trace statement is actually going to output the opposite of false, which is true.
The Concatenation Operator
The Concatenation operator, which also uses the plus (+) sign, allows you to concatenate or combine String values.
Example:
var sFName:String = "John";
var sLName:String = "Doe";
trace(sFName + " " + sLName);
// This outputs John Doe
In this example, the Concatenation operator combines the String values together. In between sFName and sLName are two quotation marks with nothing but a single empty space inside. This is an empty string that just adds a space in between the other two String values.
The Increment and Decrement Operators
- Increment (++)
- Decrement (--)
The Increment operator increments a numeric value by one (plus 1). The Decrement operator decrements a numeric value by one (minus 1).
Example:
var nScore:Number = 10;
nScore++;
trace(nScore);
// Outputs 11 (10 + 1)
In this example, nScore++ is the same as writing nScore = nScore + 1 or nScore += 1.
NOTE: If you try to trace nScore++ immediately like so:
var nScore:Number = 10;
trace(nScore++);
This will still output a value of 10. When using the increment and decrement operators, the variable will be traced first, so the original value will come out. Only after that will it be incremented or decremented. To avoid that, you can put the operator before the variable like so:trace(++nScore);
And that concludes this lesson on expressions and operators in ActionScript 3.
Local and Global Variables in AS3
In the example below, you will see two variable declarations and one function:
In the example above, we have a variable named outsideVar that's declared outside of the function, and another one named insideVar that's declared inside of the function.
Variables that are declared inside functions are referred to as local variables. So in this example, insideVar is a local variable. It is important to make this distinction because a local variable can be accessed only within the function that it was declared in.
Try to trace the local variable using a trace statement, but place this trace statement OUTSIDE of the function:
Test the movie, and you will see that this will result in an error message that says: Access of undefined property. The undefined property being referred to in this case is the local variable that you are trying to access. It's being seen as undefined because the trace statement can't find the variable. This is because the variable is inside the function and is therefore local, while the statement trying to access it is outside of the function. Trying to access a local variable from outside the function will not work. Think of it this way: it's like the function is hiding the local variable from all the outsiders. Only the ones inside the function can see it. Everyone else can't.
So if we put the trace statement inside the function instead, we'll be able to trace the local variable when the function is called (remember to call the function, otherwise it won't run).
So now, if you test the movie, you'll be able to see the value of the local variable displayed in the output window.
On the other hand, a variable that's declared outside of a function can be accessed from inside a function as well as outside. For example, if we try to trace outsideVar using a trace statement inside the function, this will not give us any errors:
If we try to trace outsideVar from outside of the function, we won't get any errors as well:
The variable named outsideVar, which we declared outside of the function, is referred to as a global variable - it is a variable that can be accessed in all areas of our code. We can access it from inside functions or outside of them.
Deciding between making a variable global or local
If you need the variable to be accessed in all areas of your code, then you can make it global by declaring it outside of any function. If the variable is only going to be used within a function's body and nowhere else, then make it local by declaring it inside the function that's going to use it.
var outsideVar:String = "outside of the function";
function myFunction():void
{
var insideVar:String = "inside of the function";
}
myFunction();
In the example above, we have a variable named outsideVar that's declared outside of the function, and another one named insideVar that's declared inside of the function.
Variables that are declared inside functions are referred to as local variables. So in this example, insideVar is a local variable. It is important to make this distinction because a local variable can be accessed only within the function that it was declared in.
Try to trace the local variable using a trace statement, but place this trace statement OUTSIDE of the function:
var outsideVar:String = "outside of the function";
function myFunction():void
{
var insideVar:String = "inside of the function";
}
myFunction();
trace(insideVar);
Test the movie, and you will see that this will result in an error message that says: Access of undefined property. The undefined property being referred to in this case is the local variable that you are trying to access. It's being seen as undefined because the trace statement can't find the variable. This is because the variable is inside the function and is therefore local, while the statement trying to access it is outside of the function. Trying to access a local variable from outside the function will not work. Think of it this way: it's like the function is hiding the local variable from all the outsiders. Only the ones inside the function can see it. Everyone else can't.
So if we put the trace statement inside the function instead, we'll be able to trace the local variable when the function is called (remember to call the function, otherwise it won't run).
var outsideVar:String = "outside of the function";
function myFunction():void
{
var insideVar:String = "inside of the function";
trace(insideVar);
}
myFunction();
So now, if you test the movie, you'll be able to see the value of the local variable displayed in the output window.
On the other hand, a variable that's declared outside of a function can be accessed from inside a function as well as outside. For example, if we try to trace outsideVar using a trace statement inside the function, this will not give us any errors:
var outsideVar:String = "outside of the function";
function myFunction():void
{
var insideVar:String = "inside of the function";
trace(insideVar);
trace(outsideVar);
}
myFunction();
If we try to trace outsideVar from outside of the function, we won't get any errors as well:
var outsideVar:String = "outside of the function";
function myFunction():void
{
var insideVar:String = "inside of the function";
trace(insideVar);
}
myFunction();
trace(outsideVar);
The variable named outsideVar, which we declared outside of the function, is referred to as a global variable - it is a variable that can be accessed in all areas of our code. We can access it from inside functions or outside of them.
Deciding between making a variable global or local
If you need the variable to be accessed in all areas of your code, then you can make it global by declaring it outside of any function. If the variable is only going to be used within a function's body and nowhere else, then make it local by declaring it inside the function that's going to use it.
Creating Optional Parameters in AS3
When a function has parameters, you don't always need to pass arguments to them. You can create parameters that are optional. To make a parameter optional, assign a value to it when it is created. This value will become the parameter's default value - the value that will be used when no argument is passed to it. Below is an example:
If you call this function without passing any arguments, then the default values assigned to the parameters will be used. If you pass arguments, then these arguments will replace the default values.
If your parameters have no default values, then they become required parameters. This means that you must pass arguments to them whenever you call the function.
If you want to make some parameters required while making the other parameters optional, the required parameters must be defined first. The optional parameters should only be defined at the end of the parameter list, after all of the required parameters have been defined.
In the example below, the first two parameters have no default values assigned to them so this makes them both required parameters. And then a third optional parameter is added only after the first two required parameters have been defined.
If we placed the optional parameter at the beginning of this function's parameter list instead, then this would have resulted in an error.
function greetPerson(greeting:String = "Hello", firstName:String = "John"):void
{
trace(greeting + " " + firstName);
}
greetPerson();
greetPerson("Hi","Susan");
If you call this function without passing any arguments, then the default values assigned to the parameters will be used. If you pass arguments, then these arguments will replace the default values.
If your parameters have no default values, then they become required parameters. This means that you must pass arguments to them whenever you call the function.
function greetPerson(greeting:String, firstName:String):void
{
trace(greeting + " " + firstName);
}
greetPerson();
// This function call will result in an error.
// Since the function parameters have no default values,
// arguments must be passed to them.
// Not passing any arguments to a function
// with required parameters will result in an error.
If you want to make some parameters required while making the other parameters optional, the required parameters must be defined first. The optional parameters should only be defined at the end of the parameter list, after all of the required parameters have been defined.
In the example below, the first two parameters have no default values assigned to them so this makes them both required parameters. And then a third optional parameter is added only after the first two required parameters have been defined.
function greetPerson(greeting:String, firstName:String, lastName:String = "Doe"):void
{
trace(greeting + " " + firstName + " " + lastName);
}
greetPerson("Hello","John");
If we placed the optional parameter at the beginning of this function's parameter list instead, then this would have resulted in an error.
Adding Function Parameters in ActionScript 3
Learn how to make your functions more flexible by adding function parameters. This introductory Flash ActionScript 3 video tutorial will teach you how.
Writing Functions in ActionScript 3
Learn how to write functions in ActionScript 3 in this introductory Flash ActionScript 3 video tutorial.
Monday, November 28, 2011
PART 3 - Fun with ActionScript 3 variables: Complete the story - Introduction to Flash AS3 Variables
- PART 1: Creating ActionScript 3 Variables and Assigning Values to them
- PART 2: Variable Naming Rules and Conventions
- PART 3: Fun with Variables - Complete the Story
Create a new Flash ActionScript 3.0 document. Then copy the code below and paste it in the script pane of the Actions Panel. Do not read the trace statement! Just read the variables so as not to spoil the activity.
Your task is to replace the value of each variable with whatever is suggested in order to complete the story in the trace statement. Do not remove the quotation marks when you replace the values. Once all the values have been replaced, test your movie, then go to the output window to read your story. You can do this activity with a friend and try to think of funny and ridiculous values for each variable.
var popArtist:String = "name of famous pop artist";
var cheese:String = "name of type of cheese";
var chemElement:String = "name of chemical element";
var bodyPart:String = "name of external body part";
var internalOrgan:String = "name of internal organ";
var songTitle:String = "title of cheesy love song";
var fighter:String = "name of famous martial artist or boxer";
var fungalInfection:String = "name of a type of fungal skin infection";
trace("A new superhero has been spotted around campus, leaping from building to building. Who is he? Are you sure you wanna know?\n\nRumor has it that this superhero is a student on campus who was bitten by a radioactive " + popArtist + ". When he woke up, he felt very strange, but still decided to attend class. His classmates thought he was acting strange, and they began to avoid him because he started smelling like " + cheese + " mixed with burnt " + chemElement + ".\n\nBut things changed when a crime occurred on campus in the afternoon of that same day. A young girl was being held at gunpoint, and was being asked to surrender her fake " + bodyPart + ". Then out of nowhere, a blurry figure came rushing to save the girl! It was the student who smelled like " + cheese + " and " + chemElement + "! He was now dressed in a lovely costume designed by " + fighter + ". With great speed, he went straight for the gunman and kicked him right in the " + internalOrgan + ". He kicked him with such great force that it made the gunamn scream: " + songTitle + "! And then the gunman ran away. The young girl was safe. And the students cheered!\n\nHappy and thankful, the young girl came up to her savior, gave him a kiss on the cheek and asked, \"What is your name, kind sir?\" To which our brave superhero replied: I am " + fungalInfection + " Man!");
//Story credits:
//dip magazine, August 2002 issue
After completing this exercise, try making your own version, and ask your friends to fill in the variables.
<< PREV: Variable Naming Rules and Conventions - Introduction to Flash AS3 Variables - PART 2
Friday, November 25, 2011
Migrating custom fields from Drupal 6 - Data reporting and visualization in Drupal 7
Learn how to migrate custom fields from Drupal 6 to Drupal 7 in this video tutorial. This is from the Drupal 7: Reporting and Visualizing Data training course by lynda.com. Visit the course details page to learn more. Visitors of this site can also get a free 7-day trial pass for complete access to the entire lynda.com library of over 1000 courses.
Migrating custom fields from Drupal 6
Data reporting and visualization in Drupal 7 - Website Example
In this video, the author shows you an example of a yoga studio's website that uses Drupal 7 to report and visualize data. This is from the Drupal 7: Reporting and Visualizing Data training course by lynda.com. Visit the course details page to learn more. Visitors of this site can also get a free 7-day trial pass for complete access to the entire lynda.com library of over 1000 courses.
Sunday, November 20, 2011
Adobe Flash CS5 and ActionScript 3 Video Tutorials in French
Course: Tutorom Adobe Flash CS5 Nouveautés et ActionScript 3.0
Author: Rachel Thiebaud
Training Site: VTC Online University.
Below, you will find free sample videos to an Adobe Flash CS5 and ActionScript 3 training course in French. This course is provided by the VTC Online University. If you wish to view the entire course, learn more about the VTC Online University and sign-up for a membership.
Nouveautés d'Adobe Flash CS5
Travail collaboratif : format de fichier .xfl
Formater du texte
Créer des colonnes
Relier des blocs de texte entre les images
Nouveau : dessiner des images animées
Créer un squelette avec l'outil Segment
Créer un effet de ressort avec l'outil Segment
Fenêtre Actions : panneaux et assistant de script
Fenêtre Actions : barre d'outils de code
Objets : classe et propriété
Objets : méthode et fonction
Variables
Expressions - Types de données
Syntaxe de code
Externaliser le code A.S
Créer un lien vers une animation
Contrôler l'animation avec des boutons Stop et Play
Déclencher une animation - Événements de souris (clic - survol…)
Déplacer un objet avec les flèches du clavier
Ajouter une action de glisser-déposer sur une image
Cliquer pour positionner un objet
Placer l'objet au premier plan
Faire disparaître une image en fondu
Cliquer pour masquer l'objet
Afficher un objet
Cliquer pour afficher un champ de texte
Personnaliser le curseur de la souris
Générer un numéro aléatoire
Afficher le temps - Compte à rebours
Animation fluide
Rotation
Copier un code d'animation
Ajouter - Supprimer instances de la bibliothèque
Charger du texte externe
Charger des images externes
Créer un menu déroulant animé
Créer des boutons de menu
Fermer un menu déroulant
Paramétrer le lecteur FLVPlayback
Extraire une image de la vidéo comme image de prévisualisation
Charger l'image de prévisualisation
Lancer la vidéo après la prévisualisation
Nouveau : insérer des points de repères directement dans Flash
Insérer des sous-titres
Lire plusieurs vidéos avec des boutons
Lire plusieurs vidéos avec une Playlist
Créer le code pour la Playlist
Présentation de l'auteur
Author: Rachel Thiebaud
Training Site: VTC Online University.
Below, you will find free sample videos to an Adobe Flash CS5 and ActionScript 3 training course in French. This course is provided by the VTC Online University. If you wish to view the entire course, learn more about the VTC Online University and sign-up for a membership.
Introduction
Présentation du tutoromNouveautés d'Adobe Flash CS5
Travail collaboratif : format de fichier .xfl
Créer du texte avec le nouvel outil TLF
Créer des paragraphesFormater du texte
Créer des colonnes
Relier des blocs de texte entre les images
Dessiner et animer des décors avec l'outil Déco
Dessiner avec de nouveaux remplissagesNouveau : dessiner des images animées
Animer avec un squelette
Utiliser les modèles d'animation FlashCréer un squelette avec l'outil Segment
Créer un effet de ressort avec l'outil Segment
Les bases d'ActionScript 3.0
Introduction et nouveautésFenêtre Actions : panneaux et assistant de script
Fenêtre Actions : barre d'outils de code
Objets : classe et propriété
Objets : méthode et fonction
Variables
Expressions - Types de données
Syntaxe de code
Externaliser le code A.S
Coder avec les fragments de code AS 3.0
Créer un lien vers une page webCréer un lien vers une animation
Contrôler l'animation avec des boutons Stop et Play
Déclencher une animation - Événements de souris (clic - survol…)
Déplacer un objet avec les flèches du clavier
Ajouter une action de glisser-déposer sur une image
Cliquer pour positionner un objet
Placer l'objet au premier plan
Faire disparaître une image en fondu
Cliquer pour masquer l'objet
Afficher un objet
Cliquer pour afficher un champ de texte
Personnaliser le curseur de la souris
Générer un numéro aléatoire
Afficher le temps - Compte à rebours
Animer avec les fragments de code AS 3.0
Animation de pixels en pixelsAnimation fluide
Rotation
Copier un code d'animation
Les fragments de code AS 3.0 pour texte et images
Cliquer pour charger des images de la bibliothèqueAjouter - Supprimer instances de la bibliothèque
Charger du texte externe
Créer un diaporama avec des boutons
Créer des boutons reliés à des images externesCharger des images externes
Créer un menu déroulant
Créer un menu principal et des sous-menusCréer un menu déroulant animé
Créer des boutons de menu
Fermer un menu déroulant
Utiliser les fragments de code AS 3.0 pour la vidéo
Introduction et nouveautésParamétrer le lecteur FLVPlayback
Extraire une image de la vidéo comme image de prévisualisation
Charger l'image de prévisualisation
Lancer la vidéo après la prévisualisation
Nouveau : insérer des points de repères directement dans Flash
Insérer des sous-titres
Lire plusieurs vidéos avec des boutons
Lire plusieurs vidéos avec une Playlist
Créer le code pour la Playlist
Conclusion
Résumé et aidePrésentation de l'auteur
Saturday, November 19, 2011
PART 2 - Variable Naming Rules and Conventions - Introduction to Flash AS3 Variables
- PART 1: Creating ActionScript 3 Variables and Assigning Values to them
- PART 2: Variable Naming Rules and Conventions
- PART 3: Fun with Variables - Complete the Story
Variable names are author-defined. This means that you, as the author of the Flash ActionScript 3.0 project, will decide which names to give your variables. But there are still some rules that you have to follow. In this part of the Introduction to Flash AS3 Variables tutorial series, we'll take a look at what those rules are. We'll also take a look at some commonly used naming conventions when it comes to working with variables.
Variable Naming Rules
Rule #1: Do not use any ActionScript 3.0 reserved words (also referred to as keywords) to name a variable.
Examples:
var var:Number;
var this:String;
var new:Boolean;
The examples above are unacceptable because var, this, and new are all ActionScript 3.0 reserved words.
Rule #2: Variable names must be unique.
The example below will generate an error message:
var myVariable:Number;
var myVariable:String;
Even if each variable is assigned a different data type, the names are the same. This will create a conflict between the two variables.
Rule #3: Variable names are case-sensitive
The following variables are considered two different variables:
var myVariable:Number;
var myvariable:Number;
In the examples above, one variable name has an uppercase V, while the other one has a lowercase v. Because of this, these two variables are considered entirely different from each other. They will not create a conflict. And it does not matter that they both have the same data type; they are still two separate variables.
Rule #4: Variable names can only use letters, numerical characters, the underscore, and the dollar sign.
The following example is unacceptable because it uses the @ sign in the variable name:
var myV@riable:String;
The underscore and the dollar sign are the only special characters that can be used when naming variables. No other special characters can be used.
Rule #5: A Variable name can only start with either a letter, an underscore or the dollar sign.
The following example is unacceptable:
var 1_variable:Number;
Although this variable name does not use any unacceptable characters, it does begin with a numerical character. Variable names can only begin with either a letter, an underscore or the dollar sign.
An acceptable version of the example above would be:
var variable_1:Number;
Here, since it does not use any unacceptable characters and it DOES NOT START with a numerical character, then the variable name is acceptable.
Rule #6: Variable names cannot contain spaces.
The following example is unacceptable because the variable name contains a space:
var my variable:Boolean;
Some Variable Naming Conventions
The following items are not rules used in naming variables, but are more of commonly-used practices and styles. You do not have to follow these suggestions, but they might help make your code more organized and easier to understand.
#1 Use variable names that are descriptive of the type of data they will hold or the purpose they will serve.
Instead of using generic variable names such as:
var string1:String = "John";
var string2:String = "Smith";
var number1:Number = 2012;
Consider using more descriptive alternatives:
var firstName:String = "John";
var lastName:String = "Smith";
var year:Number = 2012;
#2 If you want to combine different words in one variable name, you can differentiate these words by using uppercase and lowercase letters.
Instead of using:
var myvariable:Number;
Consider using:
var myVariable:Number;
This is a practice referred to as camel casing, because the visual bumps created by the uppercase letters are similar to the humps on a camel's back.
#3 You can prefix your variable names with a character that is descriptive of its data type, such as s for a String variable or n for a Number variable.
Examples:
var sTitle:String = "Learning ActionScript 3.0";
var nScore:Number = 99;
var bActive:Boolean = false;
This is a convention know as the Hungarian notation.
And that concludes this tutorial series on an Introduction to Flash ActionScript 3.0 Variables.
<<PREV: Creating ActionScript 3 Variables and Assigning Values to them - Introduction to Flash AS3 Variables - PART 1
PART 1 - Creating ActionScript 3 Variables and Assigning Values to them - Introduction to Flash AS3 Variables
- PART 1: Creating ActionScript 3 Variables and Assigning Values to them
- PART 2: Variable Naming Rules and Conventions
- PART 3: Fun with Variables - Complete the Story
Welcome to this tutorial series on an Introduction to Flash AS3 Variables. In part 1 of this series, we'll talk about what variables are, see some basic examples, and learn how to create them.
What is a variable?
Think of a variable as a container. It's like a box where you can put something in. But instead of a physical object, a variable can contain information.
A variable is made up of a name and a value. The name is like the label on the box, and the value is the item inside that box.
For example:
quantity = 12
price = 1.25
Here, we have two variables. The first variable has the name quantity, and has a value of 12. And then we have another one with the name price, and a value of 1.25.
We can then use these variables in an equation. For example:
quantity * price
In this equation, the quantity and price are being multiplied. This will give us a value of 15. Since quantity is equal to 12, and price is equal to 1.25, then 12 * 1.25 is equal to 15.
Creating Variables
Step 1
Create a new Flash ActionScript 3.0 document and type in the following lines of code in the Actions Panel:
var quantity:Number;
var price:Number;
In the first two lines, we've declared two variables - quantity and price. To declare a variable, start with the var keyword, followed by the variable name, and then the data type.
The syntax for declaring a variable is as follows:
var variableName:dataType;
What is the data type?
The data type refers to the type of value that a variable can contain. In the two examples, we've specified the Number data type. This means that the variables can only contain numbers. If you try to assign some text as the variable's value, then that will generate an error. Specifying the data type that a variable can contain is referred to as strict data typing or strong data typing.
What are other examples of data types?
Other examples of data types are the String data type and the Boolean data type. String data is made up of characters. The Boolean data type only chooses between 2 values - true or false.
Examples:
var firstName:String;
var isActive:Boolean;
Here, the firstName variable can only contain a String value such as "John" or "Mary" (String values must be enclosed in quotation marks). The isActive variable, on the other hand, can only be assigned a value of either true or false.
In the next step, let's take a look at how to assign values to our variables.
Step 2
To assign values to our variables, add the following lines highlighted in bold:
var quantity:Number;
var price:Number;
quantity = 12;
price = 1.25;
To assign a value to a variable, type the variable name, followed by the equals sign (also known as the assignment operator), and then input the desired value. Here, we have given quantity a value of 12, and price a value of 1.25.
The syntax for assigning a value to a variable is:
variableName = value;
When assigning a value to a variable, there is no need to use the var keyword again since we've already done that at the beginning. The var keyword is used to declare or create the variable. You only need to do that once. You also don't need to declare the data type again.
Step 3
If you want, you can also combine the variable declaration and the value assignment in one statement. Let's do that.
Delete the lines of code that we've already typed and replace them with this:
var quantity:Number = 12;
var price:Number = 1.25;
Here, each variable is declared and assigned a value in one statement. This is pretty much the same thing, except we have fewer lines of code.
Step 4
Next, add some trace statements to verify that Flash is able to access the values assigned to the variables:
var quantity:Number = 12;
var price:Number = 1.25;
trace("The quantity is: " + quantity);
trace("The price is: " + price);
trace("The total is: " + price * quantity);
Here, the trace statements will evaluate the variables and equations, and will display their values. For example, in the first trace statement, the variable name quantity will be displayed as 12, since 12 is the current value assigned to it. In the third trace statement, price * quantity will be calculated, and based on our current values, it will result in a value of 15.
Step 5
Test the movie. You should see the output window display the following lines:
The quantity is: 12
The price is: 1.25
The total is: 15
Step 6
After assigning an initial value to a variable, you may still assign a new value afterward. Let's try that.
After the trace statements, assign new values to the variables:
var quantity:Number = 12;
var price:Number = 1.25;
trace("The quantity is: " + quantity);
trace("The price is: " + price);
trace("The total is: " + price * quantity);
quantity = 5;
price = 2.75;
So now, after the trace statements are executed, the variables will have these new values assigned to them.
Step 7
To check whether the new values have been successfully assigned, let's add another set of trace statements after the lines that assign the new values to the variables:
var quantity:Number = 12;
var price:Number = 1.25;
trace("The quantity is: " + quantity);
trace("The price is: " + price);
trace("The total is: " + price * quantity);
quantity = 5;
price = 2.75;
trace("The values have been changed.");
trace("The new quantity is now: " + quantity);
trace("The new price is now: " + price);
trace("The new total is now: " + price * quantity);
Here, when the first set of trace statements are executed, Flash will be taking a look at the original values. But after that, the variable values have been changed, so the second set of trace statements, which comes after the new values, will now use those new values instead. The FIRST set of trace statements will use the ORIGINAL values, because those trace statements were written BEFORE the values were changed.
Step 8
Test the movie. You should see the output window display the following lines:
The quantity is: 12
The price is: 1.25
The total is: 15
The values have been changed.
The new quantity is now: 5
The new price is now: 2.75
The new total is now: 13.75
Step 9
You can also assign an equation to a variable. For example, we can get the price * quantity equation and store it in a variable like so:
var quantity:Number = 12;
var price:Number = 1.25;
var total:Number = price * quantity;
And then in the trace statements, we can replace all the instances of the price * quantity equation with the total variable instead:
trace("The quantity is: " + quantity);
trace("The price is: " + price);
trace("The total is: " + total);
quantity = 5;
price = 2.75;
total = price * quantity;
// You must compute for the total again in order to
// reflect the new value
trace("The values have been changed.");
trace("The new quantity is now: " + quantity);
trace("The new price is now: " + price);
trace("The new total is now: " + total);
This will give us the same result.
In the next part of this series, we'll take a look at the rules you have to follow when naming variables.
Friday, November 18, 2011
Learn how to make music on the iPad - Online Video Training Course
If you are interested in creating music with your iPad, let experienced engineer, author, composer, and educator Sam McGuire take you through eleven music production apps designed for the iPad in this iPad Music Production online training course. The Apps include notation software, audio / MIDI sequencers (including GarageBand), and a variety of musical instruments. This video training course is from the VTC Online University. Watch the first 3 chapters for free. Just click on the movie links below to start learning.
Settings and Usage
The iPad's Place in Your Workflow
Audio I/O
Networking
Introduction
The iPad as a Musical InstrumentSettings and Usage
Music Making
The Phases of Music MakingThe iPad's Place in Your Workflow
Accessories and Options
MIDIAudio I/O
Networking
Want to view the entire course?
Sunday, October 16, 2011
YouTube partner program now available in the Philippines
I have some good news for YouTube channel owners residing in the Philippines - the YouTube partner program is now officially available. If you are in the Philippines and you visit the YouTube partner page, you will now be able to access the application link. Users from countries not eligible to join the partner program will get redirected to the homepage when they try to access the partner page. That is no longer the case for users from the Philippines. Currently, there are around 20+ countries included in the partner program. Some of the countries included are Argentina, Sweden, New Zealand and the Czech Republic. Apply now!
Friday, September 16, 2011
How to use Photoshop Lightroom 3 Video Tutorials for Beginners with Free 7-day Trial Pass
If you're looking for excellent online training on how to use Photoshop Lightroom 3 video tutorials for beginners, then check out Photoshop Lightroom 3 Essential Training by lynda.com. This course provides a comprehensive look at Adobe Photoshop Lightroom 3, the popular photo-asset management, enhancement, and publishing application. The course covers indispensable techniques such as importing, processing, and organizing images in the Library, using interface shortcuts to navigate the workspace quickly, and creating slideshows, web galleries, and print picture packages. In addition to exploring all of Lightroom 3's capabilities, this course is rich with creative tips and expert advice on photographic workflow. Posted below are free sample videos from the course. You can learn more by going to the course details page. Also, visitors of Tutorials 101 can view this entire 13-hour course for free by signing up for a free 7-day trial pass. This gives you free access not only to this course, but to the entire lynda.com training library of over 1000 courses as well.
Tuesday, September 13, 2011
How to: Ableton Live 8 Video Tutorials for Beginners
Start learning Ableton Live 8 with these free how to - Ableton Live 8 video tutorials for beginners. These videos are from Ableton Live 8 Essential Training by lynda.com. The entire course is 7 hours in length and teaches you what you need to know to start using Ableton Live 8 to create those excellent audio and MIDI recordings. To view the entire course, you can sign-up for a lynda.com membership for as low as $25. If you want to try it out for free, visitors of Tutorials 101 can get a free 7-day trial pass, which lets you view this entire course, as well as all the other 1000+ courses at no cost for 7 days.
Friday, September 9, 2011
Flash Builder 4 and Flex 4 Video Tutorials for Beginners
Check out these free Flash Builder 4 and Flex 4 video tutorials for beginners. These are from the Flash Builder 4 and Flex 4 Essential Training course by lynda.com. This training title is designed for developers who want to learn how to build rich internet applications for the Flash player. Watch the free videos below and start learning. If you want to view the entire course, you can sign up for a lynda.com membership. Or if you first want to try it out for free, visitors of Tutorials 101 can get a free 7-day trial pass.
Saturday, September 3, 2011
How to draw a heart in Illustrator - Video Tutorial
In this video from lynda.com, author Deke Mclelland shows you how to draw a heart in Illustrator.
Deke has more Adobe Photoshop and Illustrator video tutorials in an excellent series called Deke's Techniques. You can check them all out with this free 7-day trial pass.
Deke has more Adobe Photoshop and Illustrator video tutorials in an excellent series called Deke's Techniques. You can check them all out with this free 7-day trial pass.
Friday, September 2, 2011
Sibelius 6 - Bar and Staff Selection - Video Tutorial
In this video tutorial from Sibelius 6 Essential Training by lynda.com, author Jenny Amaya introduces bar and staff selection in Sibelius 6. In this video, she first explains the difference between a system and a staff. And then she talks about basic bar selection, selecting a range of bars, selecting staff, moving notes in a bar, and using the keypad to add note head markings and accidentals. If you want to view the rest of the videos from this course, you can sign-up for a lynda.com membership or try a 7-day free trial.
Adobe After Effects CS5 Video Tutorials for Beginners
In the past couple of years, great quality homemade special effects videos have become very popular. A lot of the effects you see in those videos are done using an amazing program known as Adobe After Effects. If you'd like to get to know more about this application and how to use it, watch the free Adobe After Effects CS5 video tutorials for beginners below. These are from After Effects CS5 Essential Training by lynda.com. It's an 8 hour training course that teaches you the things you need to know to start making your own awesome special effects videos. If you want to watch the entire course, you can sign up for a lynda.com membership. Or if you want to try it out first, visitors of Tutorials 101 can get a get a free 7-day trial pass.
Tuesday, August 16, 2011
Developing iPhone Games Using Flash CS5 | iPhone Game Development Course
Interested in developing iPhone games using Flash CS5? Then check out this iPhone game development course from lynda.com. The course is entitled Flash Professional CS5: Creating a Simple Game for iOS Devices, and you will find some sample videos below. The course covers the game development from start to finish, including planning and preparation, character and background animation, creating interactions and scoring mechanism, and finally testing and publishing the app. If you like the free video tutorials below and would like to view the entire course, then you can sign up for a lynda.com membership or get a free 7-day trial.
Friday, August 5, 2011
Adobe Illustrator CS5 Video Tutorials for Beginners
Check out these free great-quality Adobe Illustrator CS5 video tutorials for beginners. You'll find 14 video tutorials posted below that will give you useful tips and will help you get started with Adobe Illustrator CS5. These free video tutorials are from the Illustrator CS5 Essential Training course by lynda.com. If you like the free video tutorials below and would like to view the rest of the course, then you can sign up for a lynda.com membership or get a free 7-day trial.