Archive for March, 2005

Useful Flash – Guitar Tuner

Tuesday, March 29th, 2005

I recently bought a new guitar and I was wondering if there were any cool tools online that would allow me to tune easily. I wanted something interactive that I could just browse to and have work. Oh yeah, I like when it is free too ;) . I ran upon this interactive guitar tuner. I thought this was one of the most useful examples of Flash I have ever seen. Basic, intuitive, functional. Thought I’d share.

Google Holiday Logo Archive

Monday, March 28th, 2005

I saw the post on the Easter Google Game by JD and visited it. I noticed this little link off of that page to the Google Holiday Logo Archive. Some cool little mods to the Google logo. Thought I’d direct link anyone interested to it.

Flashtexteditor.com Update

Wednesday, March 23rd, 2005

A big thanks to Igor who read my previous post on customizing the elements on the image panel in his Flash-based text editor. If you go here you will see that the userguide has been updated and now allows you to download a FLA which will allow you to customize the look of the “forms/windows”. It’s nice to see that Igor is a professional who stands behind his product and listens to what users want/need. So now you can all ignore my previous post with all of the loops :) . If you have purchased the component you should download the new FLA. If you haven’t bought it yet and you want to save some time and energy – you probably should.

www.flashtexteditor.com tweaks and tricks

Friday, March 18th, 2005

Recently, while working on my previously mentioned infamous project, I ran into the need for a rich text/HTML editor (rte). I had developed one using AS2 and the Macromedia component set and it worked pretty well until it came time to insert an image tag in to the mix. I had a nice ability of browsing the local system using MDM’s Zinc from the CD and then saving copies of the files into the CD’s working directory on the hard drive. The problem came when I started to realize the very poor support for the image tag in an HTML textField.

Not long thereafter I saw a post for www.flashtexteditor.com‘s editor. After trying it out and noticing how it seemed to do a better job at handling the insertion of images – I bought a copy to save time and headaches. Not far into adding it to my application I realized the need to hook up the browse feature to the already present “browse” button. If you are familiar with the component you will remember that when you insert an image it pulls a window component up with controls to set the properties of the image. The documentation (and Igor, the creator himself – I emailed him) mention that you can use the “browse” event and listen for it to set the “path” text box equal to the event object’s path property you set. I might note that in order to actually set the path text you must say: evtObj.path.text. I kept forgetting the .text being needed – I assumed the event object would be referencing that natively.

Next I wanted to reference some things in that pallet to hide (such as the ID, vSpace, etc) that a non-programming user wouldn’t need. Igor @ www.flashtexteditor.com told me this was not possible. I soon found that even the labels in the Image Attributes Window did not have instance names. I then set out to hack my way around the objects and make the thing display the way I needed it to. So for those of you that may have bought the component as well and are curious – here is my actionScript that I used to get references (that change every launch of the window component by the way). This was in my FLA so I am not sure if things will change for you based on how you are using it. Overall the component is good – the image support is not as close as I initially thought it was from the demo online but it suits my needs for now. Let me know if you have questions.

myBrowseListener = new Object();
myBrowseListener.browse = function(eo:Object){
pathBoxText = eo.path.text;
//
//References to stuff in the IMAGE panel
////ex. _root.depthChild[n].content. + a reference below
////eg. _root.depthChild1.content.vspace._visible would hide the vspace
//// component if the window it was in was in the the level _root.depthChild1
//// this is determined further down in the code and not required to know…

//vspace box
//vspace._visible = false;
//vspace label
//instance227._visible = false;
//hspace box
//hspace._visible = false;
//hspace label
//instance226._visible = false;
//autosize btn
//autosize_btn._visible = false;
//align box
//align._visible = false;
//align label
//instance228._visible = false;
//height box
//height._visible = false;
//height label
//instance225._visible = false;
//width box
//width._visible = false;
//width label
//instance224._visible = false;
//ID label
//instance223._visible = false;
//ID box
//id._visible = false;
//URL label
//instance222._visible = false;
//URL box
//url._visible = false;
//target label
//instance221._visible = false;
//target box
//target._visible = false;
//path label
//instance220._visible = false;
//path box
//src._visible = false;
//browse button
//browse_btn._visible = false;
//ok button
//ok_btn._visible = false;
//remove button
//remove_btn._visible = false;
//
}

//ref to the rich text editor’s image window browse button
rte.addEventListener(“browse”, myBrowseListener);

function readyImagePanel(pathStr){
//function to hide non-wanted items on the image panel
///////////////////////////////////////////////////
//hide stuff
///////////////////////////////////////////////////
for(i in pathStr){
//if it’s name contains “instance” (not a named instance)
if(i.indexOf(“instance”) > -1){
for(p in pathStr[i]){
//it’s a label so find out what it’s value is
if(pathStr[i].initText == “URL:” || pathStr[i].initText == “ID:” || pathStr[i].initText == “target:”){
pathStr[i]._visible = false;
}
}
}
//boxes (components)
if(i.indexOf(“id”) > -1 || i.indexOf(“url”) > -1 || i.indexOf(“target”) > -1 || i.indexOf(“autosize_btn”) > -1){
pathStr[i]._visible = false;
}
//save reference
if(i.indexOf(“height”) > -1){
heightBox = pathStr[i];
}
if(i.indexOf(“width”) > -1){
widthBox = pathStr[i];
}
if(i.indexOf(“ok_btn”) > -1){
okButton = pathStr[i];
}
//relayout out the remaining items
//path box
if(i.indexOf(“src”) > -1){
pathStr[i]._y -= 34;
}
if(pathStr[i].initText == “Path:”){
pathStr[i]._y -= 34;
}
//align box
if(i.indexOf(“align”) > -1){
pathStr[i]._y += 34;
}
if(pathStr[i].initText == “Align:”){
pathStr[i]._y += 34;
}
//width box
if(i.indexOf(“width”) > -1){
pathStr[i]._y -= 44;
}
if(pathStr[i].initText == “Width:”){
pathStr[i]._y -= 44;
}
//height box
if(i.indexOf(“height”) > -1){
pathStr[i]._y -= 44;
}
if(pathStr[i].initText == “Height:”){
pathStr[i]._y -= 44;
}
//hspace
if(i.indexOf(“hspace”) > -1){
pathStr[i]._y -= 44;
}
if(pathStr[i].initText == “HSpace:”){
pathStr[i]._y -= 44;
}
//vspace
if(i.indexOf(“vspace”) > -1){
pathStr[i]._y -= 44;
}
if(pathStr[i].initText == “VSpace:”){
pathStr[i]._y -= 44;
}
//browse button – this is scary – it moves it’s _y in relation to it’s height it seems
//so that 1.5 moves it 1.5 times it’s height
pathStr.browse_btn._y -= 1.15;
pathStr.browse_btn._x -= 3.3;

}
}

///////////////////////////////////////////////
//this listener is used to check if we click on the control button to insert an image
var listener:Object = new Object();
listener.click=function(o:Object)
{
for(i=0;i<1000;i++){
//loop through the first 1000 depths to find what depths are being used by the window component
if(eval(“_root.depthChild”+i) != undefined){
trace(“_root.depthChild”+i);
_root.imgWindowPath = “_root.depthChild”+(i-1);
}
}

switch (o.target._name) {
case “image”:
trace(“loading image window – monitor load”);
monitorImageWindow();
break;
}
}

rte.image.addEventListener(“click”, listener);

function monitorImageWindow(){
this.onEnterFrame = function(){
var cPath = eval(_root.imgWindowPath + “.content”);
//is that window done loading?
if(cPath._complete == true){
readyImagePanel(cPath);
delete this.onEnterFrame;
}
}
}

The Evils of Large Video in Flash

Thursday, March 17th, 2005

While working on a massive CD-ROM project that incorporates all sorts of technologies (on which I will probably be posting lessons learned soon) I ran into the need to show a nice big rotating globe in the background of the application. We are talking 800 x 490 or so. Long story short all I had was some old 3D I got off a Beta SP tape (no 3D source this time). I had to After Effects it and kick it out to some format that would best work in Flash while keeping the filesize down. If not for watching the size so closely I may not have had to go the following route… I needed to get the file IN the main swf (no external swfs – don’t ask). I tried the swf route but since I was using Squeeze to keep the filesize down there were no keyframes when imported. I thought I would try the good ‘ol FLV.

The FLV was imported INTO the main swf and placed inside a movieclip (No Media Components, etc.). This had nice filesize but there seemed to be a slight hit whenever it looped. You could tell the FLV was starting over. The loop was frame to frame perfect – a perfect loop. I thought I’d be funny and tried to monitor the current frame position of the embedded video using an onEnterFrame. Once I was getting that I checked to see if I was on the last frame of the embedded video and then I said embeddedVideo.gotoAndPlay(1). Guess what… No more hit… Seamless… Interesting no? – I told it to do what it should have been doing anyway…

Just thought I’d blog this little nugget in case anyone else was ever planning on the same sorta idea.