So, I’ve had to do this on a few occasions now, and I have found the most efficient ( well in terms of lines of code ) to do this in Actionscript 3.

Before you can use this, you must have the x,y positions of the the 2 objects you want to calculate the distance between ( of course ).

The line of code I ended up using looks like this

var distance:Number = Point.distance(new Point(objectA.x, objectA.y),
                                     new Point(objectB.x, objectB.y));

There may be ways to extract the point object right out of an objects, if so , let me know. But this definately works.. now I can move on  to finishing my app : )

This is an issue I have been wrestling with for a few months now.

It’s come to a point now where I have to figure out. The issue is, when I create a custom event so I can transport data between my loosly coupled components, the eventListener never picks it up.

I found this pretty straightforward easy to understand article here, that explains that the event never travel across from component to component ( up and down the container stacks ) but in fact only travel 1w ay, up the stack to the parent.

Ok so that is great to know..  now the only way I can trap these events is always attach my listeners inside my custom components to the systemManager.  Do I always have to do that ? seems weird.

Anyways I discover more, I will comment on this post

Adobe Air library

August 17, 2009

I recently came across a very good library called everythingflexairlib.

This library includes :

Components

  • NativeAlertWindow
  • AlertWindow
  • ContextWindow
  • SuperWindow

Managers

  • ConnectionManager
  • UpdateManager
  • IconManager

You can download the swc and source code hosted at Google code

January 28, 2009

This is the raw message we receive from an onJoinRoom event sent from SmartFox Server with our custom room variables, the libs will parse this up for us, which is pretty decent and helpful.

<msg t='sys'>
  <body action='joinOK' r='3'>
    <pid id='-1'/>
    <vars>
      <var n='suit0' t='s'>
        <![CDATA[h]]>
      </var>
      <var n='currentRank' t='n'>
        <![CDATA[3]]>
      </var>
      <var n='user_cards_count' t='n'>
        <![CDATA[1]]>
      </var>
      <var n='usersExchanged' t='n'>
        <![CDATA[2]]>
      </var>
      <var n='playerRanked' t='n'>
        <![CDATA[0]]>
      </var>
      <var n='numRounds' t='n'>
        <![CDATA[2]]>
      </var>
      <var n='userTurn' t='n'>
        <![CDATA[2]]>
      </var>
      <var n='last_player_played' t='n'>
        <![CDATA[3]]>
      </var>
      <var n='dealer_id' t='n'>
        <![CDATA[2]]>
      </var>
      <var n='user_face_value' t='n'>
        <![CDATA[13]]>
      </var>
      <var n='inGame' t='b'>
        <![CDATA[1]]>
      </var>
      <var n='exchange' t='b'>
        <![CDATA[0]]>
      </var>
    </vars>
    <uLs r='3'>
      <u i='1626' m='0' s='0' p='4'>
        <n>
          <![CDATA[666580371]]>
        </n>
        <vars>
          <var n='rank' t='s'>
            <![CDATA[President]]>
          </var>
          <var n='fb_uid' t='n'>
            <![CDATA[666580371]]>
          </var>
          <var n='card_count' t='n'>
            <![CDATA[0]]>
          </var>
          <var n='screen_name' t='s'>
            <![CDATA[Taylor *]]>
          </var>
          <var n='ready' t='b'>
            <![CDATA[1]]>
          </var>
          <var n='pic_url' t='s'>
            <![CDATA[http://profile.ak.facebook.com/v222/795/44/q666580371_719.jpg]]>
          </var>
          <var n='chipTotal' t='n'>
            <![CDATA[10229]]>
          </var>
          <var n='chipsEarned' t='n'>
            <![CDATA[349]]>
          </var>
        </vars>
      </u>
      <u i='1621' m='0' s='0' p='2'>
        <n>
          <![CDATA[1607303638]]>
        </n>
        <vars>
          <var n='rank' t='s'>
            <![CDATA[unranked]]>
          </var>
          <var n='fb_uid' t='n'>
            <![CDATA[1607303638]]>
          </var>
          <var n='card_count' t='n'>
            <![CDATA[4]]>
          </var>
          <var n='screen_name' t='s'>
            <![CDATA[Mike]]>
          </var>
          <var n='ready' t='b'>
            <![CDATA[0]]>
          </var>
          <var n='pic_url' t='s'>
            <![CDATA[http://profile.ak.facebook.com/v229/1007/83/q1607303638_6612.jpg]]>
          </var>
          <var n='chipTotal' t='n'>
            <![CDATA[4590]]>
          </var>
          <var n='chipsEarned' t='n'>
            <![CDATA[0]]>
          </var>
        </vars>
      </u>
      <u i='1622' m='0' s='0' p='3'>
        <n>
          <![CDATA[616006432]]>
        </n>
        <vars>
          <var n='rank' t='s'>
            <![CDATA[unranked]]>
          </var>
          <var n='fb_uid' t='n'>
            <![CDATA[616006432]]>
          </var>
          <var n='card_count' t='n'>
            <![CDATA[1]]>
          </var>
          <var n='screen_name' t='s'>
            <![CDATA[Lynn1204]]>
          </var>
          <var n='ready' t='b'>
            <![CDATA[0]]>
          </var>
          <var n='chipTotal' t='n'>
            <![CDATA[4854]]>
          </var>
          <var n='pic_url' t='s'>
            <![CDATA[http://profile.ak.facebook.com/v223/1303/36/q616006432_2358.jpg]]>
          </var>
          <var n='chipsEarned' t='n'>
            <![CDATA[0]]>
          </var>
        </vars>
      </u>
      <u i='1613' m='0' s='0' p='1'>
        <n>
          <![CDATA[1112396589]]>
        </n>
        <vars>
          <var n='rank' t='s'>
            <![CDATA[Vice President]]>
          </var>
          <var n='fb_uid' t='n'>
            <![CDATA[1112396589]]>
          </var>
          <var n='card_count' t='n'>
            <![CDATA[0]]>
          </var>
          <var n='screen_name' t='s'>
            <![CDATA[Sheldon 917]]>
          </var>
          <var n='ready' t='b'>
            <![CDATA[1]]>
          </var>
          <var n='pic_url' t='s'>
            <![CDATA[http://profile.ak.facebook.com/v230/1144/60/q1112396589_520.jpg]]>
          </var>
          <var n='chipTotal' t='n'>
            <![CDATA[1737]]>
          </var>
          <var n='chipsEarned' t='n'>
            <![CDATA[149]]>
          </var>
        </vars>
      </u>
      <u i='1631' m='0' s='1' p='-1'>
        <n>
          <![CDATA[Spectator886]]>
        </n>
        <vars>
          <var n='rank' t='s'>
            <![CDATA[unranked]]>
          </var>
          <var n='fb_uid' t='n'>
            <![CDATA[0]]>
          </var>
          <var n='card_count' t='n'>
            <![CDATA[0]]>
          </var>
          <var n='screen_name' t='s'>
            <![CDATA[Spectator886]]>
          </var>
          <var n='ready' t='b'>
            <![CDATA[0]]>
          </var>
          <var n='chipTotal' t='n'>
            <![CDATA[0]]>
          </var>
          <var n='pic_url' t='s'>
            <![CDATA[http://london-ontario.com/play_president/assets/table/default/spectator.png]]>
          </var>
        </vars>
      </u>
    </uLs>
  </body>
</msg>

multi-user flash games

January 6, 2009

I just come across a network that will power a flash game with:

  • real-time multi-user capability
  • data storage api
  • payment api
  • acheivements
  • high score

the service is called Nonoba

Flex Facebook app in beta

December 22, 2008

We have finally released our first social gaming Flex application on Facebook.  The application is called Presidents & Assholes, it based on the popular card game Asshole. The application is real-time, and requires 4 live players to activate a game table. We have added a betting component, so users have a sense of reward.

Presidents and Assholes The application has a Spectator mode that will allow users to “preview” the game without forcing them to install. This same preview is available to the global internet without logging into Facebook. You can preview the game by clicking http://apps.facebook.com/play_president/.

The game has an easy to use chat window that will broadcast your message to the room. Users can enter and leave any number of game table rooms, and optionally sit down if they have installed the Facebook app.

Yahoo Social platform

December 17, 2008

Today I received some info about the new Yahoo Social platform

Don’t know much about it yet, but more to come.

The URL to the Yahoo Social Directory is http://developer.yahoo.com/social/socialdir/

hmm and even better there are some Flex 3 libs for the Yahoo Social Directory API