Archive for October 16, 2007

Volume Controls

 One concept in flash I need to develop is using sound, looping and stopping sound, but more importantly making controls to enable the viewer to change the volume or turn the sound completely off.  This will not only help with my project but will also enable me to improve projects I have completed in previous modules and will enable me to use this application during my final year project for my radio website, where the need for some kind of volume control is essential.

  • Open a new Flash document.
     
  • Create a button symbol.
     
  • Make a new movieclip symbol and label it Sound
     
  • Drag an instance of your new button symbol into the movieclip. Make sure with the button selected within the movieclip that the x,y coordinates for the button are set to “0”.
  • Still working within this new movieclip select the button, open the actions panel, and place the following actions on it.

on (press){

startDrag(“”,false,0,0,0,-100);

}on (release, releaseOutside){

stopDrag();

}

Code Explanation:

  • While pressing the mouse button you will be able to drag the movieclip from 0 of the y coordinate to -100 on the y coordinate. Remember my explanation above, using the graphic artists’ coordinate system, this code will allow you to drag the movieclip 100 pixels going up from it starting point. It goes up because the number is smaller then its origin.
     
  • On release (letting go of the mouse) or ReleaseOutside (dragging away from the movieclip and letting go of the mouse) the drag will end and the movieclip will remain where it was dragged to.

Step 2
Creating the controller

  • Create a new movieclip and call it volume_controller.
     
  • Label layer one meter.
     
  • Starting at the registration point draw a straight vertical line up. You could use creativity here by drawing a crooked line or other meter type of graphic. We will set this line to 100 pixels in height and make sure it is locked center on the registration point. Select the line and use the property inspector to set the height to 100 and the x coordinate to 0. To make sure the line begins exactly at the registration point set the y axis to -50.

Step 3

  • Create a new layer and label it Sound. Drag an instance of your movieclip symbol, “ Sound “, on to this new layer and set it exactly at the registration point. Make sure its x and y coordinates are both set to 0, this is important. Give your movieclip symbol an instance name of Sound. To do this you select it and in the property inspector where it says <Instance name> click and type knob.

Step 4

  • Add a new layer and label it text.
     
  • On this layer add a text box slightly over to the right of the content of the other two layers.
     
  • Select the text box use the property inspector to set the text box as a dynamic text box and set the variable name to vol. I will explain this later.

  Step 5

  • Add a new layer and label it actions.
     
  • Insert a keyframe in frame two and a keyframe in frame three.
     
  • On all earlier layers insert a frame in frame three.

Step 6
Adding the actions

  • Select keyframe one of the actions layer and add the following actions.

smooth_audio = new Sound();Sound._y = -25; Step 7
Finishing the movie.

  • Return to the main timeline. On layer one drag an instance of the movieclip volume_controller to the stage.
     
  • Add a new layer.
     
  • Import an audio track to Flash.
     
  • Select the first keyframe of the new layer and have it play the audio. Go ahead and test your movie.

 Information taken from http://www.webthang.co.uk/Tuts/tuts_fmx/scott4/scott4d.asp 

Other helpful tutorials:

http://www.kirupa.com/developer/mx/volume_slider.htm

http://www.webwasp.co.uk/tutorials/b15-sound-volume/index.php

http://www.youtube.com/watch?v=b6FmgrhLp3s

Advertisements

Flash mobile idea

Over the past couple of weeks I have been brainstorming ideas for my project, and have decided to make a prototype for a flash media device to enhance and publicise a new band.

My main idea is to get fans of “Monday Street” band to sign up and leave mobile numbers either on their My space page or when they leave or enter the gigs. The new device will enable them to watch new videos from gigs, get up to date information about the band, and if possible use the application as a way of listening to new song.

I am currently researching further into Flash mobile itself, talking to media professionals to engage in where the application has advanced and how I can use this module to gain skills I can use when I graduate.

Some key resources to help with my initial research

www.adobe.com/devnet/devices/ 

http://www.adobe.com/products/flashlite/

Flash Lite 3 Video: 

“Video on mobile devices represents a new challenge for both device manufactures and developers. Flash Lite 3 opens an amazing new world to mobile developers.”

From looking at a number of resources I have been to see that being able to use this new application would enable me to be one step ahead of potential graduates.

One of the key areas that I will research into is the accessibility and usability of the mobile device, I will have to bear in mind that all mobiles have different keys that are placed in different places, it will be one of my main aims to make sure that my application is totally user friendly, one way of doing this I believe is setting more simple “key press” applications in flash that could work for all different mobile. The only way I will thoroughly work through this process if by user testing and then further more adapting my application to suit the

There are a number of explanations and tutorials online that will help me in quest in developing a new flash mobile video application for my assignment.

http://www.adobe.com/devnet/devices/articles/fl3_video.html

Michelle Field – Random Movement

In the development of my Flash knowledge I have decided to research how to do random movement using action script. I have previously made a game where the enemies move along a set path, therefore this time I wish to advance my skills and make the game more challenging to players using unpredictable movement.The following takes you through the process for random movement in Flash MX:

1) Open a new Flash document.

2) Set the stage area to 300 x 200 pixels. At this point you may also wish to draw in the stage boundaries, for example by using the rectangle tool.

3) Set the frame rate to 25 secs.

4) Draw a circle (the object in which you wish to move) using the tool box.

5) Select the circle and convert it into a movie clip by right clicking on it and selecting convert to symbol, then select movie clip.

6) Select the movie clip and add the following code into the actions box (where // is present this is additional information about each section):

onClipEvent (load) {

//data you may want to change depending on stage size
width = 300;
height = 200;
//You can increase the speed by increasing the numbers and vice versa 
speed = Math.round(Math.random()*2)+1;
//initial positions and new ending positions
x = this._x=Math.random()*width;
y = this._y=Math.random()*height;
x_new = Math.random()*width;
y_new = Math.random()*height;
}
onClipEvent (enterFrame) {

//x horizontal movement 1 being right and -1 being left
if (x_new>this._x) {

sign_x = 1;
} else {
sign_x = 1;
}
dx = Math.abs(x_newthis._x);
if ((dx>speed) || (dx<-speed)) {

this._x += sign_x*speed;
} else {
x_new = Math.random()*width;
}
//y vertical movement
if (y_new>this._y) {

sign_y = 1;
} else {
sign_y = 1;
}
//handles the speed throughout 
dy = Math.abs(y_newthis._y);
if ((dy>speed) || (dy<-speed)) {

this._y += sign_y*speed;
} else {
y_new = Math.random()*height;
}
}

7) Now you can view it by pressing Ctrl and Enter.

This information was gained from:
http://www.kirupa.com/developer/actionscript/random_motion.htm 
which will also be useful for a more detailed version of the above.