ActionScript 1.0 to ActionScript 2.0

  • Jose Carvalho
  • Born
  • Born
  • Jose Carvalho
  • Posts: 2

Post 3+ Months Ago

I,hm starting now with AS 2, and Ì´fe already done a lot of progress so far. In one of my projects i tried to load a swf file written in actionscript 1.0 into a swf written in 2.0, but although all my efforts I didn´t manage to solve the conversion from the code in AS1 to AS2, could please help me in this matter.
I´m placing the code, so that you could tell me if I need to write it all in AS2, or is there a easier way to solve it.

thanks!

function initialize () {
gGridW = 4
gGridH = 3
gImageWidth = 400
gImageHeight = 300
gSpeed = 5
gMenuUpTime = 2000
gInsideMenu = false
gTimerOn = false
gStartTime = 0
gMenuUp = false
buildGrid ()
}
function buildGrid () {
for ( j = 0; j < gGridH; j++){
for ( i = 0; i < gGridW; i++){
imageId = j * gGridW + i
iName = "IMAGE" + imageId
_root.iMosaic.attachMovie("sBlankImage",iName,imageId)
_root.iMosaic[iName]._x = i * gImageWidth
_root.iMosaic[iName]._y = j * gImageHeight
_root.iMosaic[iName].tText = String(iName)
}
}
_root.iMosaic._x = 0 - _root.iMosaic._width / 2
_root.iMosaic._y = 0 - _root.iMosaic._height / 2
}
function menuClick (id) {
trace("**MenuClick: " + id)
iName = "Image" + id
_root.iMosaic[iName].iLoader.loadMovie("imgs/img" + id + ".swf",iName)
gotoX = (0 - id % gGridW) * gImageWidth
gotoY = (0 - Math.floor(id / gGridW)) * gImageHeight
zoomOut ()
_root.iMenu.iMenu[id].gotoAndStop(2)
gMoving = true
}
function doLoop () {
if (gMoving) {
var dx = gotoX - _root.iMosaic._x
var dy = gotoY - _root.iMosaic._y
trace("dx: " + dx + "dy: " + dy)
_root.iMosaic._x = _root.iMosaic._x + dx / gSpeed
_root.iMosaic._y = _root.iMosaic._y + dy / gSpeed
if ((Math.abs(dx) < 1) && (Math.abs(dy) < 1)) {
gMoving = false
_root.iMosaic._x = gotoX
_root.iMosaic._y = gotoY
}
}
}
function startTimer () {
gTimerOn = true
gStartTime = getTimer()
}
function resetTimer () {
gStartTime = getTimer()
}
function killTimer () {
gTimerOn = false
}
function doTimer () {
if (gTimerOn) {
if (gMenuUpTime < getTimer() - gStartTime) {
trace("mouse within menu")
zoomOut ()
}
}
}
function doMenuMouseMove () {
if (_root.iMenu.iMenu.hitTest(_root._xmouse,_root._ymouse,false)) {
trace("mouse within menu")
if (!gTimerOn) {
zoomIn ()
}
resetTimer ()
}
}
function zoomIn () {
trace("ZoomIn")
_root.iMenu.gotoAndPlay("ZoomIn")
startTimer ()
}
function zoomOut () {
trace("ZoomOut")
_root.iMenu.gotoAndPlay("ZoomOut")
}
function ZoomOutDone () {
killTimer ()
}
stop()
initialize ()
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.