Blog

  • MovieClip-esque’ Sprite Creation in Director

    I missed my attachMovie and removeMovieClip commands from Flash whilst in Director, and after not being satisfied with some of the sprite engines posted on <a href=”http://www.director-online.com/”>Director-online.com</a>, I built my own. It’s far from complete, as I added like no error checking, but it still works as long as you don’t screw up (like attach a sprite to the same depth, but that doesn’t work well in Flash either, now does it?)

    Like everything in Director, though, you need at least something on the stage to get this to work. It’s really simple, though.

    – open the bitmap window
    – give it a name “blank”
    – close the bitmap window. This should put it as a cast member in your case
    – add it to sprite channel 1
    – repeat the same keyframe for as many sprites as you think you’ll use (I did the max, 1000, cause I’m freaky-deaky like that)
    – add this code as a movie script (or with your other code)
    <pre><code>
    global gSprites

    on prepareMovie

    gSprites = [:]

    end

    on attachSprite memberName, spriteName, spriteDepth
    s = Symbol(spriteName)
    if voidP(gSprites[s]) then
    sprite(spriteDepth).member = member(memberName)
    sprite(spriteDepth).member.regPoint = point(0, 0)
    gSprites[s] = sprite(spriteDepth)
    return sprite(spriteDepth)
    end if
    end

    on removeSprite spriteName
    i = gSprites.getOne(spriteName)
    if voidP(i) = false then
    s = Symbol(spriteName)
    gSprites[s].member = member(“blank”)
    gSprites[s].locH = 0
    gSprites[s].locV = 0
    gSprites.deleteOne(gSprites[s])
    return true
    else
    return false
    end if
    end

    on gSprite spriteName
    return gSprites[Symbol(spriteName)]
    end
    </code></pre>

    Now, if you want to use it, just do:
    <pre><code>
    — attach
    mySprite = attachSprite(“MemberName”, “spriteString”, 1)
    mySprite.locH = 320
    mySprite.locV = 240
    — remove
    removeSprite(“spriteString”)
    </code></pre>

    And, instead of that sprite(5) bs, you can do:
    <pre><code>
    gSprites[#spriteString].locH = 5
    –or, if your not familiar with Symbols in Director
    gSprites[Symbol(“spriteString”)].locH = 5
    — or
    gSprite(“spriteString”).locH = 5
    </code></pre>

    :: extends chin ::
    Tasty beef!

  • EventBroadcaster for Director

    You have to implement via Decorator pattern (think that’s the one…) instead of using initialize, but so far, seems to work. The only issue is, I am still trying to figure out how to do Function.apply in Director… because currently, I’m just passing the parameters as an array to the call method; which was the point of Function.apply being able to have any number parameters passed as an array, and then doing the argument distribution for you. At any rate, here’s what I got:
    <pre><code>
    property pListeners

    on new me
    init()
    return me
    end

    on init me
    pListeners = []
    end

    on broadcastMessage me, msg
    howMany = pListeners.count()
    repeat with n = 1 to howMany
    o = pListeners[n]
    if o.handler(msg) = true then
    l = paramCount()
    a = []
    repeat with i = 2 to l
    a.append(param(i))
    end repeat
    call(Symbol(msg), o, a)
    end if
    end repeat

    end

    on addListener me, obj
    pListeners.append(obj)
    end

    on removeListener me, obj
    howMany = pListeners.count()
    repeat with n = 1 to howMany
    if pListeners[n] = obj then
    pListeners.deleteProp(n)
    return true
    end if
    end repeat
    return false
    end
    </code></pre>

    And you can implement in your Parent Scripts (or behaviors I guess) like so:
    <pre><code>
    property pBroadcaster

    on new me
    init()
    end

    on init me
    pBroadcaster = script(“EventBroadcaster”).new()
    end

    on addListener me, obj
    pBroadcaster.addListener(obj)
    end

    on removeListener me, obj
    success = pBroadcaster.removeListener(obj)
    return success
    end

    on broadcastMessage me, msg
    pBroadcaster.broadcastMessage(msg, param1, paramN)
    end
    </code></pre>

    …still, would be great to figure out how to pass dynamic amounts of parameters like you can in Flash using Function.apply…

  • Components Panel & MM’s Dual Licensing

    First, just installed <a href=”https://www.blinex.com/”>B-Line Charting components</a> (re cause I lost my old set), and just love the new way components are in nested in the panel. The other way was cool, but when your like me and have 50 million MXP’s installed… it’s just quicker, manxt!

    Secondly, I gotta thank MM for their dual install license thing. The fact that I use Dreamweaver at work to code in, Fireworks to edit the interfaces I get, and Flash 2k4 at home just… just frikin’ rules. It’s so convenient. As soon as I get work to upgrade their Studio (:: prays ::), I can then move to my laptop instead, and take my work with me.

    Since they’ve been getting some shlcack from a lot of angles, figured I’d voice my appreciation to balance it out. I should voice it before balancing needs being done, but that opening of a new component tree just made me snap. The license thing just… occured to me on the way to work this morning in a pre-coffee stupor. A lot more time for the mind to wander now that I live in Tim-buck-too with Deliverance peeps a stone-throw away.

  • Motion Man, No More Statcom Neihbors, Bling Bling, LCService Stalemate, & Lack of Follow Up

    Dude, I used After Effects most of the day. Talk about a serious change of pace. After a long time (really long) of Flash MX, Dreamweaver MX (for coding), and Visual Source Safe, it’s just a totally different feeling. May not last long, but gonna lay down the funk as much as possible so the peeps at the meeting my co-workers and I have Tuesday with the another dept. are impressed and inspired enough to really get hyped up about what we are working on, therefore making collaboration that much more positive & constructive. Naturally, as much as I loved what I was able to accomplish in a day after such a long absence from using AE, I seemed to have failed once again in my Typography. Her majesty gave me some great suggestions, but I don’t think I can just stick to being an Animator when I’m not coding (or mixing audio); I really need to take a Typography course or two so I can at least get a good jolt in the right direction. It’s gotta be my weakest point next to networking in my skillsets. Thank God for geek friends!

    <a href=”http://www.statcom.com/”>Statcom</a>, a sister company of sorts, had some devs working nearby me (across from my cube, in what I call no-mans-land, QA is on the East Side, I’m on the West SIIIIIIIIIIIIIIIIIIIIDE with the managers and Vice President of SIS). Erik, the other Flasher that works in my department, said farewell this week as well as the Java guys who I also love to hang with. They headed to the 5th floor (it’s pretty pimp when I went up there), but man, I’m gonna miss just knowing they are there. Yeah, we can still play DoD together, and go to lunch, and play pool in the break room, but… the same reason I miss them is the same reason I love tech-conferences; MORE GEEKS! Change is good, though, and this is for the best as they grow as a company.

    Her majesty <a href=”http://mediadiva.net/mt/archives/000303.html”>scanned the rock</a> I got her… no, that is NOT glass…

    Dude, 2 new features I GOTTA implement into my blog somehow:
    – comment subscriptions & management so you can unsubscribe from a post’s comments (that’s it on the management; wanna keep simple). I have a hard time continuing discussions with people on blogs longer than about an hour as I usually garbage collect my windows and close what I’m not using anymore, thus, closing the blog’s post I was discussing with people (cept for <a href=”http://www.oscartrelles.com/blog/”>Oscar’s</a>… that mofo has a sweet system, I’m so jealous…).

    Sent off the sample app I developed to learn Central to my man <a href=”http://www.darronschall.com/”>D</a>. Got my arsed kicked by LCService (App to Agent I smoked, Agent to App I befuddled). Tomorrow evening, I’ll read <a href=”http://www.macromedia.com/devnet/central/articles/lcservice.html”>that article</a> <a href=”http://www.markme.com/mesh/”>Mike</a> pointed me to, and hopefully I’ll see the error of my ways. I did everything in Central and had NO problems with any of the code, so didn’t really care about my battle with the Central debugger. That’s what bothers me about LCService… I must have been tired, because I just couldn’t see what I was doing wrong in my Agent. Didn’t matter, the elated high of getting my LCDataProvider to work was a good painkiller.

    Off to code Flash for the potential future of my country… :: dun, duh-daa, dahhhhhh!!!! ::