LoginSignup
1
1

More than 5 years have passed since last update.

Flashの動きをCoronaで再現する

Last updated at Posted at 2012-12-31
  • トレース開始フレーム
var mc = shine;
var xcoords = "";
var ycoords = "";
var widths = "";
var heights = "";
var alphas = "";

addEventListener(Event.ENTER_FRAME,traceMc);
function traceMc(event:Event) { 
    xcoords += (mc.x + ",");
    ycoords += (mc.y + ",");
    widths  += (mc.width + ",");
    heights += (mc.height + ",");
    alphas  += (mc.alpha + ",");
}
  • トレース終了フレーム
trace( "xcoords = { " + xcoords.slice( 0, -1 ) + " }");
trace( "ycoords = { " + ycoords.slice( 0, -1 ) + " }");
trace( "widths = { "  + widths.slice( 0, -1 ) + " }");
trace( "heights = { " + heights.slice( 0, -1 ) + " }");
trace( "alphas = { " + alphas.slice( 0, -1 ) + " }");
removeEventListener(Event.ENTER_FRAME, traceMc);
stop();
  • Corona
(Paste coords trace info from Flash)
local i = 1
local function moveObject()
  if i <= #xcoords then
    object.x = xcoords[i]
    object.y = ycoords[i]
    object.width = widths[i]
    object.height = heights[i]
    i = i + 1
  else
    Runtime:removeEventListener( "enterFrame", moveObject )
  end
end
Runtime:addEventListener('enterFrame', moveObject)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1