Sunday, February 25, 2007

contolling objects in FlashMX


tool : Flash MX

Moving object as movie clips in Flash can be achieved in various ways. One of them is controlling objects with text input box.
First, create new file. You will need two things, movieclip that represents object, and button with input text box. My creations are on picture below.



For button, for every state put keyframe. Set show border around text. Set input text with var : "distance".
Set movieclip instance name as "wheel". Finaly enter action for button:

on(keyPress "< Enter>"){
  _root.onEnterFrame=function(){
    if (_root.wheel._x < distance){
      _root.wheel._x += 5;
      _root.wheel._rotation +=5;
    }
    if (_root.wheel._x > distance){
      _root.wheel._x -= 5;
      _root.wheel._rotation -=5;
    }
  }
}

Another way of moving movieclip is with mouse. In this case we don't have button. MovieClip is same, and only code is in first frame of main timeline.
_root.onEnterFrame=function(){
  if (_root.wheel._x < _xmouse){
    _root.wheel._x += 10;
    _root.wheel._rotation +=10;
  }
  if (_root.wheel._x > _xmouse){
    _root.wheel._x -= 10;
    _root.wheel._rotation -=10;
  }
}
Posted by flanture at 23:13:12 | Permanent Link | Comments (0) |

Thursday, February 08, 2007

integration

I was wondering what if somebody is deeply in as1 and as2 and have doubts  about learning as3. How to use many lines of code written earlier, with new avm2. Well, solution is already here, as I said before.  FlashInterface is about actionscript virtual machines communication. It provides direct communications between flash8 and flash9 avms. 
Posted by flanture at 12:59:07 | Permanent Link | Comments (0) |

Friday, February 02, 2007

search first code later

How many times did happen to you to start programming something, and later on you find out it already exists and it is open source? Too many? Well, I suppose if this is happening to often, one is just a  novice, like me.  So,  search first, code later.  I just wanted to start programming something like _this_. Now, my plans are ruined, what will I do?! Nice work, though.
Posted by flanture at 11:53:15 | Permanent Link | Comments (0) |