my interests and experiences
RSS icon Email icon Home icon
  • flash seekbar indicator won’t go away

    PROBLEM: The Flash seekbar indicator is still on screen when you navigate to a different frame that doesn’t even have the seekBar

    I came across this issue when I wanted to add just the seekbar to the flv component and not have the entire skin. I will use my chapterTest flv from an earlier post for the sake of simplicity. Here is a screenshot of the interface with the flv and seekbar

    seekbar interface

    seekbar interface


    and here is a screenshot of the interface on another frame after the flv played
    seekbar with indicator

    seekbar with indicator


    NOTE:The indicator is still there in the lower right.

    SOLUTION:The very simple way around this problem is to actually put the seekBar inside a movieclip and reference it there – that’s it!

    So my actionscript originally looked like this:import mx.video.*;
    //flv playback component instance name=flv
    //seekBar component instance name=seeker
    flv.seekBar = seeker;
    var listenerObject:Object = new Object();
    listenerObject.complete = function(eventObject:Object):Void {
    gotoAndPlay("end");
    };
    flv.addEventListener("complete", listenerObject);

    and changed to this:import mx.video.*;
    //flv playback component instance name=flv
    //seekBar component instance name=seeker
    //place seeker inside movieclip instance named seeker_mc
    flv.seekBar = seeker_mc.seeker;
    var listenerObject:Object = new Object();
    listenerObject.complete = function(eventObject:Object):Void {
    gotoAndPlay("end");
    };
    flv.addEventListener("complete", listenerObject);

  • recession-aggresssion flash game

    Well, it is finally out… the wait is over…  the flash game that is latest craze – Recession-Aggression! Check it out here http://www.recession-aggression.com

    recession-aggression screen shot

    recession-aggression screen shot

    This is a first-person throwing game that I helped develop more or less to relieve a bit of the stress that has been coming with the recession and the downturn of the economy.

    This game is hilarious and really deserves a few plays to get good.  It has a score multiplier that can really get your score up there, and if anything it’s just fun to throw items at someone.  Speaking of which, it has the ability to be able to upload your own image of a villain to target – now that is fun!

    Check it out you won’t be disappointed, if anything you will get hooked!
    www.recession-aggression.com

  • Flash XML/PHP News Feed Editor

    Here is a simple news feed type reader with a flash shell that uses PHP to write/edit an XML file and saves the changes.

    (Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

    You can select “Add new feed” from the drop down to create a new feed, or you can select a feed and click the delete button to delete the selected feed.

    I can post the source if need be – just leave me a comment.

  • Flash text does not align

    I ran into another weird issue again in flash.  Here is what the text looks like in the flash authoring environment

    authoring text

    authoring text

    and here is what it looks like when it is published
    unaligned_text

    Very odd.  I took it upon myself to find the solution and it actually came pretty quick, and with further investigation I found the actual problem as well.

    The fix that I found to align the text back up with itself was to set the text anti-aliasing to be “anti-aliasing for animation” rather than “anti-aliasing for readability”.

    rotateantialiasingThe reason that the text was not aligning was because I had inadvertently set a -.3 degree rotation to the text box.  It wasn’t enough that it was noticable in flash authoring, but when flash rendered the text for readability, it became noticiable when I published the file.

    So my advice, when you have text alignment issues, first check that you haven’t added a rotation to it, and if you haven’t you can at least set the text to anti-aliasing for animation and that should fix it, otherwise set your rotation back to zero and you will be good to go.

  • AS3 – how to do eval() the right way

    In AS2 we used to be able to refer to an instance name of an object by coding:

    ///AS2.0\\\
    eval("my_mc"+i);

    This would allow you to create and/or refer to instance names using a string. I have heard quite a bit of negativity about eval() but it did come in handy at times. In AS2, you could also use:

    ///AS2.0\\\
    _root["my_mc"+i];

    which worked well for me when pushing items to an array, before AS3 was available.

    Now, the correct AS3 way to do it is either this:

    ///AS3.0\\\
    this["my_mc" + i];

    or:

    ///AS3.0\\\
    this.getChildByName("my_mc" + i);

    I would recommend the second way of doing it, because to me it just makes more sense.

  • create chapters in an FLV like a DVD

    Since flash doesn’t have anything built into it for setting chapters or in and out points in an flv, I thought I would take it upon myself to figure it out.

    Here is what I came up with:

    (Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

    1. Add an instance of the FLVPlayback component to your stage and give it an instance name of “flv” – catchy, hey?

    2. add the following actionscript to the first frame of your timeline

    var listenerObject:Object = new Object();
    var curTime;
    function playChapter (startSecond:Number, endSecond:Number) {
    listenerObject.playheadUpdate = function (eventObject:Object):Void {
    curTime = flv.playheadTime;
    trace(curTime);
    if (curTime>=endSecond) {
    flv.pause();
    }
    }
    flv.seekSeconds(startSecond);
    flv.play();
    }
    flv.addEventListener("playheadUpdate",listenerObject);

    3. link the instance of your FLVPlayback component to an flv of your choice.

    4. create chapter buttons on the stage

    5. place this code on the buttons

    on(release){
    playChapter(2,5); //change these numbers to your start time and stop time, in seconds
    }

    **Note** Make sure you encode your FLV with at least a keyframe every 1 second otherwise you won’t be able to start and stop at the correct times.  For this example I have it keyframe every 15 frames, cause the video plays 15fps.

    Good Luck!

  • movieclip instance name to string

    The way to get the instance name of a movie clip to a string is to use

    [instanceName].toString();

    rather than

    instanceName.toString();

    the later will just return something to the effect of [Object object]
    This is a very simple script, but it also can be very useful!

  • Flash – dynamic text color and styles

    Another nuance of dynamically loaded text. In order to have your dynamic text have different colors or styles, what you need to do is select the “Render as HTML” button in the properties for your text box. Click either Bold or Italic, in the properties pane, then you need click the embed font button and select the character you want to embed. This will allow you to style that text box with the style you chose.

    If however you want to change the text within the same text box that requires a bit more work. You will have to create 3 text boxes 1 on stage and 2 off stage. The one on stage will be the normal style. Embed the characters for that text box, and then for the other two off stage, set one to be bold and the other to be italic, and then embed the characters for those. This will allow you to add dynamic HTML content that has both bold and italic styles in one text box.

    I have also found that you should write out in long hand the < and > symbols as &amp;&lt; and &amp;&gt;. Flash doesn’t seem to like to load the content if you aren’t typing them out that way.

    One final thing about text color in a dynamic text box. This can be achieved by using the deprecated HTML font tags and adding your color to them. For example:

    <FONT COLOR='#721d87'><B>www.grogler.com</B></font>

    NOTE – Be sure to use the long hand version of the greater than and less than symbols.

  • Flash Scrollpane – mouse wheel

    This was something that was driving me nuts a few months ago so I thought I would add it here. When I was dynamically loading content into a scrollpane in flash, I wanted to use the mouse wheel to scroll the content. I could adjust the amount that it would scroll by using:

    ///my_sp is the instance of the scrollpane
    my_sp.vLineScrollSize = 50;

    But it seemed to just randomly scroll every once in a while. I realized that is was because the mouse pointer just happened to be on the loaded text at that given time. So the work around I found for this was to add a rectangle to the lower most layer of the movieclip that was being loaded into the scrollpane. I set the alpha of it to zero and wahlah – it worked. Seems like a flaw in the scrollpane if you ask me.