Friday, May 4, 2012

I'm Alive!

Well! It's been quite awhile since I was here last. Hopefully my absence will prove beneficial. I have been pursuing my Masters degree in Information Technology and will graduate in June of 2012. It's been an enjoyable and challenging experience. Its been a bit of a departure from working with Flash authoring so I haven't been able to bring the two pursuits together.

I'm not sure what I will pursue in these blogs in the future.  Koolmoves has been on the back shelf for me.  I still get the email notices from the forum but I don't have the latest version. Perhaps when I get settled into a new job I can take it up again.

Until then, these pages will still have the tutorials. Perhaps there will be other topics as the days progress.

Thursday, January 27, 2011

Creating a Custom Brush Library in Painter 11

The documentation in Painter 11 states that large brush libraries take up more RAM. Creating a new Brush library and then loading it from within Painter is one solution. Before we begin we need to understand the terminology and the file structure of the brushes. In Painter, the default library is a folder called Painter Brushes along with an associated xml file of the same name. The purpose of the xml file for the library is to index the brush categories so that the Brush Selector in Painter will properly display them. Within this library folder are the Brush categories and associate image files in JPEG format. Within each category are stored the brush variants.


Setting Up the Files

The first thing we should do is navigate to the brushes folder (Program Files/Corel/Corel Painter 11/Brushes). Then copy and paste the Painter Brushes xml file and rename it. In our example I am going to name it “myWatercolors”. Then create a new folder called “myWatercolors”. We now have a new empty brush library folder with its own xml file which we will edit next.

Editing the xml file

Right click on the new xml file(myWatercolors) and select edit. Note that we have all of our brush categories listed with index numbers. For example “Acrylics” is listed first with the number “1”. Note that the last one is “Markers” with number “37”. Select and delete all the lines that index the brush categories except the first line and change it to number “38” and call it “Watercolor”. It should look like this:

We cannot re-use these index numbers or we will get the names that the default library uses. Therefore we use the next unused number.

Putting Brushes in the Library Folder

We’ll want some Brushes in the library to get started with so let’s copy from the Painter Brushes library folder the Watercolor folder (the brush category) and the watercolor.jpg file, and then paste them into the myWatercolors library folder. The thing to remember is that our index name in the xml file, the brush category folder name, and the image file name should be the same. In this case it is “Watercolor”. If we want to call it something else, make sure to change all three.

Open Painter as usual and then click the black triangle at the upper right of the Brush Control Window and click “Load Brush Library…”. You should get a dialog box that allows you to select your new library (myWaterColors) and if you did everything right it should load and contain only the watercolor brushes from the default library. From here you can create and delete brush variants to your heart’s content. If we want other categories in this library (such as a pencil category) we can close out of Painter, and edit the xml file by copy and pasting the watercolor brush line and changing our number “38” to “39” and calling it “Pencils”. We can then copy the Pencils folder and the pencils JPEG file from the Painter Brushes library folder, and copy them into our new myWatercolors library folder. When we re-open Painter the Pencils will show in our Brush Selector along with our Watercolors. I hope that helps you get started.

Good luck and happy painting!

Monday, August 16, 2010

Mute Button, soundChannel and soundTransform


Every sound that plays in the flash player plays through a unique sound channel. In order to control a sound that we have loaded and are able to play in Koolmoves we need to use this soundChannel Class. We play the sound through the sound Channel and if we want to stop the sound, we stop the sound Channel and not the sound itself. When it comes to controlling a sounds volume we use the soundTransform Class. In this post we are going to make a Mute Button, which is in reality a volume toggle. If we were to stop the sound using the soundChannel we would then have to come up with a way to re-load it. But we want the ability to turn the sound on and off while the sound continues playing. This is done with a conditional statement as we will see.


If you haven't done so, load up the previous file on loading a sound. This is what we will be working from. If you haven't got that project yet, go ahead and review the post on here: EYE-gor's Place: Koolmoves and Sound.
Add a button object from the koolmoves library or make one and name it "muteBtn". Leave this on the stage and open the ActionScript Editor. You should have a sound object in the Symbol Library with a class name of Ambient and your ActionScript on the timeline should look like this:


var ambientSound:Ambient = new Ambient();
ambientSound.play();


add two new variables after the first line of code:


var scChannel:SoundChannel = new SoundChannel();
var stTransform:SoundTransform = new SoundTransform();


and edit the last line of code to look like this:


scChannel = ambientSound.play();


from this point we are setting up our sound to play through a soundChannel defined as "scChannel" and set up a SoundTransform object called "stTransform". We should be able to play this again except this time the sound is playing through the soundChannel we have defined. The SoundTransform object is doing nothing yet. Our code should now look like this:


var ambientSound:Ambient = new Ambient();
var scChannel:SoundChannel = new SoundChannel();
var stTransform:SoundTransform = new SoundTransform();
scChannel = ambientSound.play();


The SoundTransform class contains properties for volume and panning, so this is the means by which we will develop the mute Button. We begin by starting to write an eventListener and a function for the button we have previously placed on the stage and add the code after our list of variables.


var ambientSound:Ambient = new Ambient();
var scChannel:SoundChannel = new SoundChannel();
var stTransform:SoundTransform = new SoundTransform();


muteBtn.addEventListener
    (MouseEvent.CLICK,muteButtonHandler);


scChannel = ambientSound.play();


This event listener tells the player to listen for a mouse button click on our muteBtn. When the button is clicked it will call the function "muteButtonHandler" which we will write next. Add the following code after the event Listener so your code looks like this:


var ambientSound:Ambient = new Ambient();
var scChannel:SoundChannel = new SoundChannel();
var stTransform:SoundTransform = new SoundTransform();


muteBtn.addEventListener
    (MouseEvent.CLICK,muteButtonHandler);


function muteButtonHandler(evt:MouseEvent):void{
    if (stTransform.volume > 0){
        stTransform.volume = 0
    }else{
        stTransform.volume = 1;
    }
    scChannel.soundTransform = stTransform;
}


scChannel = ambientSound.play();


What we have written is a conditional statement that says if the volume is greater than zero, or if the volume is on, turn the volume off. Otherwise turn the volume on. A "0" indicates 0% system volume and a "1" indicates 100% system volume. A".5" would indicate 50% system volume so you can see how this SoundTransform class is used for volume control. Within the function the soundTransform object itself has been passed into the sound Channel. The function for the mute Button will now turn our soundChannel on and off.


These last two Blog posts have explored adding a sound through the Symbol Library, playing it, passing that sound object through a soundChannel, and applying the SoundTransform volume properties to a mute Button function in order to mute the sound.

Sunday, August 15, 2010

Koolmoves and Sound


Many times on the Koolmoves forum at Flashkit there are questions relating to sound. There are a number of ways to manipulate sound in Flash and ActionScript 3 has a few classes related to handling sound. But for now we will look at a simple procedure for loading sound and then we'll look at constructing a Mute Button to manipulate that sound. Sounds by themselves can be sound effects, ambient sound or external playlist sound. Sound effects can be used when a button is clicked and these can be applied directly to the button via the GUI. Ambient Sound, such as background music can be added to the Movie either externally or they can be embedded into the movie by way of the Symbol Library. (We are going to use the Symbol Library method). External playlists are beyond the scope of this Tutorial but they fall into the realm of XML and media player controls.
To begin, you will need to save a sound file in the folder that you are saving your Koolmoves project. You can get good demo files here at Necromanthus.com under the Music tab. Just click on one you like and save into your folder. I chose "Daemon".
Now, with Koolmoves open and set for Flash 10 AS3 export, open the symbol library (F11). Under the "Sounds" tab click "New" and navigate to your sound file and select and open it. In the next dialog box give it a class name. In my case I call it "Ambient" even though it is music. It could be birds chirping or the sound of cars or whatever you wanted. Click Ok. You have just saved a sound file, and given it a class name. We will now use ActionScript to load and play this sound.

Next, open the ActionScript editor. I usually right click the stage and select "Edit Frame Action Script".
The first thing we will do is instantiate our sound with the following code.

var ambientSound:Ambient = new Ambient();

where "ambientSound" is the name of our child of the class Ambient which we previously created in our Symbol Library. You can name it whatever you like.

Then we simply tell it to play with:

ambientSound.play();
This will play the sound through one time. Notice that since is not a visual object we don't need to add it to the stage with an addChild(). If you want the sound to loop, you need to pass the play() two arguments such as play(0,3) which tells the sound to play at the beginning and loop 3 times.

Click OK and test your movie, you should hear your sound. Most people like to manipulate the sound, so we will be considering that next time with the creation of a Mute Button which will make use of the soundTransform class and the soundChannel class.

Saturday, July 17, 2010

The Loader() Class


I've been working on a project with Koolmoves which eventually will display images in an Online Gallery. ActionScript 3 does this with the Loader() class. This class is designed to load external images and movies and display them on screen. This blog post begins to demonstrate the loader class for those just starting out.
The first thing you will need to do is prepare a JPEG file and for convenience sake name it "image" and save it to a folder which you can name, again for convenience sake, "loaderClass". Open a new KoolmovesFlash version there. Save your fun file in this loaderClass folder as "loaderSample".
Now open the ActionScript editor (make sure ActionScript 3 is showing at the bottom)and we will use the contructor method of the loader class to define a new instance of this loader class. We'll call this new instance "imageLoader" and use the addChild method to add it to the stage. You always have to use addChild() for anything to show up visually when you play your movie.

var imageLoader:Loader = new Loader();
addChild(imageLoader); 
At this point we have an empty Loader object on the stage called imageLoader. Now we have to call the load method to bring in our image. So we call this method by writing it thus:

imageLoader.load(new URLRequest("image.jpg"));
 
Your code then should look something like this.

You may have to save your file again in order to get results like I did, but you should have your image show up in the upper left hand corner of your movie. That is about how simple it gets with this class. Hopefully we can continue exploring this class as time permits. You can also position your image by manipulating the imageLoader like this in order to re-position it on the stage.
Your image should move 30 pixels to the right and 30 pixels down.

Wednesday, July 14, 2010

Hannah

"Hannah and the Dog" - pastel  My friends daughter when she was little. Back in the 90's.

Sunday, July 4, 2010

Apple Blossoms

The source photo for this painting appeared in an earlier post.  I had originally taken some photos to use as greeting card art.  Here is one of those photo's painted with Corel Painter 11 using it's watercolor tools.  It is intended to be reminicient of Cheng Kee Chee's work, with whom I studied with at one time.


"Apple Blossoms" watercolor on paper