Web Design Forum: converting AS1 to AS2? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

converting AS1 to AS2? plz help in this code Rate Topic: -----

#1 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 11:09 AM

i have a very very old tutorial and i need ur help to convert this code to AS 2 plz,, plz all help me in this,,,
i uploaded the files
thx all
startDrag("dragControl", true);
stop();


// --------------------------------------------
// tmi=total duplicates (2)
// dup=new movie duplicates
// butn=original movie
// --------------------------------------------
m = 0;
while (Number(m)<Number((/:tmi*2)-1)) {
	m = Number(m)+1;
	dup = "butn" add m;
	// Depth of this layer and depth of city layer CANT be the same. So in this layer I add 10 to the depth to make sure of that.
	duplicateMovieClip("butn", dup, Number(m)+10);
	setProperty(dup, _x, Number(getProperty(dup, _x))+Number(m*getProperty(dup, _width)));
}



// -------------------------------------------
// MAKE THE DRAG WORK
// -------------------------------------------
// SET DRAG SPEED (inverse)
speed = 75;
drag = "/dragControl";
/:w = getProperty("/nav", _width);
/:xPos = getProperty(drag, _x);
/:yPos = getProperty(drag, _y);
// next line centers the menu drag to the screen
/:xPos = /:xPos-(400/2);
setProperty("/nav", _x, getProperty("/nav", _x)-(/:xPos/speed));
if (Number(getProperty("/nav", _x)) <Number(-(/:w/2))) {
	setProperty("/nav", _x, 0.01);
} else if (Number(getProperty("/nav", _x))>0) {
	setProperty("/nav", _x, -/:w/2);
}




gotoAndPlay(_currentframe-1);

Attached File(s)


0

#2 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 11:22 AM

i uploaded the fla and swf files ;)

Attached File(s)


0

#3 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 19 August 2008 - 11:42 AM

Hello

Will need to see the fla for this one. You can upload a fla by sticking it in a folder, zipping it - for windows: right click on the folder, select Send To -> Compressed(zipped) Folder - then you can upload the folder by clicking on Browse in the Attachments box, select the zipped folder + click on Open, then click on UPLOAD. If the files are online, you can post a link to them.


Rob
0

#4 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 12:01 PM

thx Rob i did ;)
0

#5 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 19 August 2008 - 12:05 PM

View Postnana, on Aug 19 2008, 13:01, said:

thx Rob i did ;)

:D
0

#6 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 19 August 2008 - 12:16 PM

Hello

Do you just want to copy the functionality of that example or does it need to be based on that code? You can achieve the same effect with a lot less effort.

Rob
0

#7 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 12:35 PM

View PostRoberto, on Aug 19 2008, 13:16, said:

Hello

Do you just want to copy the functionality of that example or does it need to be based on that code? You can achieve the same effect with a lot less effort.

Rob


yes rob i do need the functionality of this example to use it in another example which contain a moving product bar and when the mouse go to the left the bar move to left faster and so on if mouse gose to right,,,
and when the bar reched the end it will start over again.
0

#8 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 19 August 2008 - 12:44 PM

Hello

Will do it after lunch.

Rob
0

#9 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 12:46 PM

ok thx ;)
0

#10 User is offline   Roberto 

  • Rain Dog
  • PipPipPipPip
  • Group: Members
  • Posts: 532
  • Joined: 19-August 07
  • Reputation: 2
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 19 August 2008 - 02:36 PM

Hello

I've uploaded two versions - one that behaves the same as the as1 version you uploaded + the other which stops scrolling when the mouse pointer isn't above it.

If you look at the library, you will see that I've created a top left registered movieclip (images) - which is just some color squares in a row. I've positioned this on the stage and given it the instance name of image1_mc. Then I dragged another copy of images from the library on to the stage + positioned it so its left edge is against the right edge of image1_mc + given it the instance name of image2_mc. Having another copy of the same movieclip on the stage does not increase the size of the movie.

As well as moving the pictures left/right, the role of the actionscript is to check the position of each of the movieclips - if one of the movieclips is completely out of the screen, it is positioned adjacent to the opposite edge of the other image - so the scroll can continue - if its out of the screen, stick it on the end of the other image.

You adjust the acceleration by changing line 3 : var scrollSpeed:Number = 12; Higher the number - faster it goes.

scrollstop.fla uses a new layer at the bottom of the timeline, which has a rectangle movieclip placed on it (capture_mc) that is slightly smaller than the stage. On each frame a hitest is performed on this movieclp + _xmouse. If its true, the images are moved. This is used instead of rollOver/rollOut as its a little more accurate - though not much. The problem is that the flash movie retains the last position of the mouse before it left the movie, so you use a movieclip smaller than the stage to try to capture the rollOut - hoping the mouse position that is retained is outside of the movieclip.

Let me know if it needs more explaining.

Rob

Attached File(s)


0

#11 User is offline   nana 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 68
  • Joined: 28-May 08
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 19 August 2008 - 02:50 PM

thz Rob ill try it at my project and ill tell u the if i have any problem thx alot :D
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users