Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




[F8] Converting Javascript To Actionscript



Hi, i have one html i need converter to action scriptt. anyone help me.

var Orig=new Array();
var Sat = new Array();
var Azimuth=0.0;
var Elevation=0.0;
var diff,F1,Y = 0.00;
var mcitystate, msatellite = "";

function UpdateLatLong(form) {
mcitystate=form.CityState.options[form.CityState.selectedIndex].value;
Orig=mcitystate.split("/");
form.Latitude.value = Orig[2];
form.Longitude.value= Orig[1];
form.Azimuth.value = "";
form.Elevation.value = "";
}

function UpdateSatPos(form) {
msatellite=form.Satellite.options[form.Satellite.selectedIndex].value;
Sat =msatellite.split("/");
form.SatPosition.value = Sat[0];
form.Azimuth.value = "";
form.Elevation.value = "";
}


function RoundNum(num, places) {
var snum = new String(num);
var decimal = snum.indexOf(".",[0]);
return (snum.substring(0,decimal+places+1));
}

function Degrees2Radian(angle) {
return angle * Math.PI / 180 ;
}

function DoCalc1(form) {

form.CityState.options.selectedIndex = 0;
form.Satellite.options.selectedIndex = 0;
Orig[1] = form.Longitude.value;
Orig[2] = form.Latitude.value;
Sat[0] = form.SatPosition.value;

if ((Orig[1]=="" )||(Orig[2]=="")||(Sat[0]=="")) {
alert("Please Enter Latitude, Longitude, Satellite position values");
}
else
{
latangle = Degrees2Radian(Orig[2]);
longangle = Degrees2Radian(Orig[1]);
satangle = Degrees2Radian(Sat[0]);
diff = Math.abs(Sat[0] - Orig[1]);

diff = Degrees2Radian(diff);

F1 = (Math.cos(latangle) * Math.cos(diff));
Y = Math.acos(F1);//Y in Radian

Azimuth = Math.acos(-Math.tan(latangle)/Math.tan(Y)) * 180 /Math.PI;
Elevation = Math.atan( (Math.cos(Y) - 0.15116) / Math.sin(Y)) * 180 / Math.PI;

if (Sat[0] - Orig[1] > 0) {
Azimuth = 360 - Azimuth;
}
Azimuth = RoundNum(Azimuth,1);
Elevation = RoundNum(Elevation, 1);

form.Azimuth.value = Azimuth;
form.Elevation.value = Elevation;

//message = ("Latitude : " + Orig[1] + "");
//message += ("Longitude: " + Orig[2] + "");
//message += ("Azimuth : " + Azimuth + "");
//message += ("Elevation: " + Elevation + "");
//alert(message);
}

}

function DoCalc(form) {
mcitystate=form.CityState.options[form.CityState.selectedIndex].value;
msatellite=form.Satellite.options[form.Satellite.selectedIndex].value;
if (mcitystate=="" ) {
alert("Please enter a city and a state.");
}
else {
if (msatellite=="") {
alert("Please select a satellite.");
}
else
{
Orig=mcitystate.split("/");
Sat =msatellite.split("/");
latangle = Degrees2Radian(Orig[2]);
longangle = Degrees2Radian(Orig[1]);
satangle = Degrees2Radian(Sat[0]);
diff = Math.abs(Sat[0] - Orig[1]);

diff = Degrees2Radian(diff);

F1 = (Math.cos(latangle) * Math.cos(diff));
Y = Math.acos(F1);//Y in Radian

Azimuth = Math.acos(-Math.tan(latangle)/Math.tan(Y)) * 180 /Math.PI;
Elevation = Math.atan( (Math.cos(Y) - 0.15116) / Math.sin(Y)) * 180 / Math.PI;

if (Sat[0] - Orig[1] > 0) {
Azimuth = 360 - Azimuth;
}
Azimuth = RoundNum(Azimuth,1);
Elevation = RoundNum(Elevation, 1);

form.SatPosition.value = Sat[0];
form.Latitude.value = Orig[2];
form.Longitude.value= Orig[1];
form.Azimuth.value = Azimuth;
form.Elevation.value = Elevation;

//message = ("Latitude : " + Orig[1] + "");
//message += ("Longitude: " + Orig[2] + "");
//message += ("Azimuth : " + Azimuth + "");
//message += ("Elevation: " + Elevation + "");
//alert(message);
}
}
}



FlashKit > Flash Help > Flash ActionScript
Posted on: 07-07-2007, 02:56 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Converting Actionscript 6 To 4
Hey there can anyone help me convert this script to flash 4 and actually make it work??
It's pretty basic , but it's really hanging me up --

Version 6
---------------------------------
on (release) {

//sets the _y position based on the variable "yPos" set at beggining of the movie.

_root.menu1.gotoAndStop("up");
setProperty(_root.menu1, _y, yPos1);
}
---------------------------------

I have tried this for version 4

---------------------------------
tellTarget ("/menu2") {
gotoAndStop("up");
setProperty("/menu2", _y, yPos2);
}
---------------------------------

AND

---------------------------------
tellTarget ("/menu2") {
gotoAndStop("up");
setProperty("/menu2", Y position) = yPos2;
}
---------------------------------

AND

---------------------------------
tellTarget ("/menu2") {
gotoAndStop("up");
setProperty("/menu2", Y position, yPos2);
}
---------------------------------
AND

Begin Tell Target ("/menu2")
Go to and Stop ("down")
Set Property ("menu2", Y Position) = yPos2
End Tell Target
---------------------------------
?

Any suggestions would be appreciated!

thanks.

Old Actionscript Needs Converting?
Can someone help me modernise this code into Flash MX actionscript?

Begin Tell Target ("../scroll")
Set Property ("slider", Y Position) = (../:scrolltext.scroll - 1) / (../:scrolltext.maxscroll - 1) * ../:balkheight
End Tell Target

cheers,

Converting Actionscript From Mx To 5
I have a peice of code that it working nicely in mx, but when i publish it as flash 5, it stops working because the syntax isn't right. what in the script needs to be changed so that it will work in 5?

function fadeIn() {
if (this._alpha>=100) {
delete (this.onEnterFrame);
} else {
this._alpha += 10;
}
}
_root.circle._alpha = 0;
_root.circle.onEnterFrame = this.fadeIn;

thanks so much!

Help Converting To Actionscript 2.0
I have a FlashMX "screens" application all developed and I'm just trying to add a chart to it, using a sample I found on the web: http://www.flash-db.com/Components/?...pe=Bar%20Chart

When testing out the sample, it works when compiling it as actionscript 1.0, but doesn't work when compiled as AS2.0, and my screens application must be compiled with AS2.0

Any help with what I would need to change in this small piece code is greatly appreciated, thanks!

here's chart:

/* Incoming data is in the form
<dataSet>
<data>
<name></name>
<dataRow></dataRow>
</data>
</dataSet>

*/
// Prepare Bar Chart for Data.
chart.removeAll();
chart.setChartTitle("Scripting language usage on all servers");

function convertXML () {
mainTag = new XML();
elementTag = new XML();
dataList = new Array();
elementList = new Array();
mainTag = this.firstChild;
if (dataXML.loaded) {
if (mainTag.nodeName == "dataSet") {
dataList = mainTag.childNodes;
for (i=0; i<=dataList.length; i++) {
if (dataList[i].nodeName == "data") {
elementList = dataList[i].childNodes;
for (j=0; j<=elementList.length; j++) {
elementTag = elementList[j];
elementType = elementTag.nodeName;
if (elementType == "name") {
Name = elementTag.firstChild.nodeValue;
}
if (elementType == "dataRow") {
Info = elementTag.firstChild.nodeValue;
}
}
// Adds the label and data to the Chart.
var pollData = {label: Name, value: Info}
chart.addItem(pollData);
}
}
}
}
}

Converting Actionscript 1 To 2
Im a beginner to actionscript and im trying to convert an actionscript 1 to 2 but i keep gettin this error can ne one rewrite this 4 me so that it works in actionscript 2


PHP Code:



colnum = "1";
startnum = 1;
endnum = 6;
numberofItems = 6;
mouseposX = int(getProperty("../dragscale", _x));
mouseposY = int(getProperty("../dragscale", _y));
i = startnum;
m = startnum;
filledSpace = 0;
gapspace = 0;
if (Number(myInit) == Number(FALSE)) {
    // on first run make an array of all the text Y Pos.
    while (Number(i)<=Number(endnum)) {
        set("textX" add i, getProperty ("text" add i, _x));
        i = Number(i)+1;
    }
    i = startnum;
    myInit = TRUE;
}
boundleft = getProperty ("../boundbox" add colnum, _x);
boundright = boundleft + getProperty ("../boundbox" add colnum, _width) ;
boundtop =  getProperty ("../boundbox" add colnum, _y);
boundbottom = boundtop + getProperty ("../boundbox" add colnum,_height);
if (Number(mouseposX)>=Number(boundleft) and Number(mouseposX)<=Number(boundright) and Number(mouseposY)>=Number(boundtop) and Number(mouseposY)<=Number(boundbottom)) {
    while (Number(i)<=Number(endnum)) {
        myDif = (eval("textX" add i) ) - (mouseposX - boundleft);
        // percentage increase
        scaleAmount = 250-((myDif*myDif)/16);
        alphaAmount = 100-((myDif*myDif)/6);
        if (Number(alphaAmount)<50) {
            alphaAmount = 50;
        }
        if (Number(scaleAmount)<100) {
            scaleAmount = 100;
        }
        setProperty("text" add i, _xscale, scaleAmount);
        setProperty("text" add i, _yscale, scaleAmount);
        setProperty("text" add i, _alpha, alphaAmount);
        i = Number(i)+1;
    }
    // *** add up total Y pixels taken by text ***
    while (Number(m)<=Number(endnum+1)) {
        filledSpace = filledspace + getProperty ( "text" add m, _height);
        m = Number(m)+1;
    }
    // *** find total Y pixels not taken by text
    totalheight = getProperty ( "text" add endnum, _y) + getProperty ( "text" add startnum, _y);
    gapSpace = totalheight-filledspace;
    avgDistance = gapSpace/numberofitems;
    m = Number(startnum)+1;
    while (Number(m)>=Number(endnum-1)) {
        setProperty("text" add m, _y, (getProperty ( "text" add (m-1), _y) + getProperty ( "text" add (m-1), _height)) + avgdistance);
        set("watchheight" add m, getProperty ( "text" add m, _height));
        m = Number(m)+1;
    }
} else {
    // *** shrink text back when mouse rolls out
    i = startnum;
    while (Number(i)<=Number(endnum)) {
        if (int ( getProperty ("text" add i, _yscale ) ) >= 100) {
            // return scale back to original state
            setProperty("text" add i, _yscale, int ( getProperty ("text" add i, _xscale ) ) -1);
            setProperty("text" add i, _xscale, int ( getProperty ("text" add i, _yscale ) ) -1);
        }
        if ( getProperty ("text" add i, _y) < eval("textY" add i)) {
            // return y position back to original state
            setProperty("text" add i, _y, int ( getProperty ("text" add i, _y ) ) + 1);
        }
        if ( getProperty ("text" add i, _y) > eval("textY" add i)) {
            setProperty("text" add i, _y, int ( getProperty ("text" add i, _y ) ) - 1);
        }
        if ( getProperty ("text" add i, _Alpha) > 50) {
            setProperty("text" add i, _alpha, int ( getProperty ("text" add i, _alpha ) ) - 1);
        }
        i = Number(i)+1;
    }





this is the error i keep gettin


PHP Code:



**Error** Symbol=02 - textcol1, layer=scale actions, frame=2:Line 14: ')' or ',' expected
             set("textX" add i), getProperty ("text" add i, _x));

**Error** Symbol=02 - textcol1, layer=scale actions, frame=2:Line 16: Unexpected '}' encountered
         }

Total ActionScript Errors: 2      Reported Errors: 2 




Plz i need this ASAP thanx

Converting To ActionScript 3
I have being trying to convert a SlideShow from AS2 TO AS3

ConclusionButton.onPress = function(){
goToAndStop("conclusion");
}

this moves to conclusion page which has a Back Button on it, so to get to previous page I tried

BackButtonMarketing.onPress = function(){
goToAndStop("marketing")
}
all the above actionScript is in its own layer in one page.

which gives no error message, but doesn't do anything. There are back buttons on each of the slides, aswell as Next Buttons. I have mades sure each of these buttons have been an instance name. Please can any one give me some pointers.

Thanks

Converting A Fla To Actionscript 2.0
For a previous research project, I decided to use Flash to create visualizations of computer generated data. I took xml output, fed it through one frame - called "getXML" which loaded the XML, and then had a gotoandplay() to a frame where I had written some actionscript to parse the xml and turn it into an animation.

Now that I'm done with the project, it has been passed on to someone else who doesn't have Flash. It would be really nice If I could somehow convert the two frame sequence of my .fla file into an .as file, so that it could be compiled using an open source actionscript compiler, such as http://www.mtasc.org. Unfortunately, the xml parsing scripts and the scripts for creating the animation don't like to be in the same frame.

Is there any way to create and name frames from actionscript 2.0, so that the xml scripts will be completely executed before the animation scripts?

(here's an example of my animation.... click in the box and outside and it will load a default xml - http://planetarium.physics.dal.ca/visual2.swf)

Help Converting To Actionscript 2.0
I have a FlashMX "screens" application all developed and I'm just trying to add a chart to it, using a sample I found on the web: http://www.flash-db.com/Components/?...pe=Bar%20Chart

When testing out the sample, it works when compiling it as actionscript 1.0, but doesn't work when compiled as AS2.0, and my screens application must be compiled with AS2.0

Any help with what I would need to change in this small piece code is greatly appreciated, thanks!

here's chart:

/* Incoming data is in the form
<dataSet>
<data>
<name></name>
<dataRow></dataRow>
</data>
</dataSet>

*/
// Prepare Bar Chart for Data.
chart.removeAll();
chart.setChartTitle("Scripting language usage on all servers");

function convertXML () {
mainTag = new XML();
elementTag = new XML();
dataList = new Array();
elementList = new Array();
mainTag = this.firstChild;
if (dataXML.loaded) {
if (mainTag.nodeName == "dataSet") {
dataList = mainTag.childNodes;
for (i=0; i<=dataList.length; i++) {
if (dataList[i].nodeName == "data") {
elementList = dataList[i].childNodes;
for (j=0; j<=elementList.length; j++) {
elementTag = elementList[j];
elementType = elementTag.nodeName;
if (elementType == "name") {
Name = elementTag.firstChild.nodeValue;
}
if (elementType == "dataRow") {
Info = elementTag.firstChild.nodeValue;
}
}
// Adds the label and data to the Chart.
var pollData = {label: Name, value: Info}
chart.addItem(pollData);
}
}
}
}
}

Converting Actionscript 1.0 To 2.0
I am working an item I intend to integrate into a video player. The just of it is that I have nine buttons that I want to loop inside of an area that allows me to scroll them left or right depending on my mouse location in a defined area.

I have a basic setup with 3 layers: actions, tracker, and scrolling object.

Actions contain, well, the actions.

Tracker layer contains movieclip with instance 'tracker', which has a button (no instance name).

Scrolling object layer contains movieclip instance 'scrollingobject'. Inside of this are the buttons that will load the videos eventually.


I got this example working in actionscript 1.0, but when I publish to actionscript2.0. The trace in the second script gives an output of '[Type Function]' (this may or may not be helpful).

Suggestions to convert this functionally to 2.0?

===================================================================










Attach Code

/// in frame 2 out of 21
mover = getProperty(scrollingobject, _x);

//in frame 20 of 21
mouseh = getProperty(tracker, _x);
mousev = getProperty(tracker, _y);
if (Number(mousev)>200 and Number(mousev)<280) {
movevalue = (Number(movevalue*9)+Number(((mouseh-320)/20)))/10;
trace(Number);
}

// in frame 21
mover = Number(mover)+Number(movevalue);
if (Number(mover)>1278) {
mover = 0;
}
if (Number(mover)<0) {
mover = 1278;
}
setProperty(scrollingobject, _x, mover);
gotoAndPlay(20);

//attached to the tracker
on (rollOver) {
startDrag(tracker, true);
}

Help With Converting Actionscript 2 To 3
Hello all. I am new to the forum and need help converting some classes developed in actionscript 2 into actionscript 3. The classes create a reusable selection system framework that I am using here to create a menu. The system is made up of two base classes and two extending classes used to customize it till your hearts content.

I have converted a lot of it already, but have run into an error that I just can't seem to figure out. I have attached a zip file containing both the old AS2 and new AS3 class files and an example fla of each.

You will notice that the AS3 demo menu buttons have no title like the AS2 ones do. I have commented the code that sets the title in the AS3 class because that is what is causing the error. It is line 92 in the UIButton AS3 class. Once you uncomment it the compiler throws Error #1009: Cannot access a property or method of a null object reference.

I have done some googleing on the error but I can't seem to solve it. I am sure that it is a logic error in converting to actionscript 3.

Thank you all in advance for any help you maybe able to provide.

ryan

Converting From Actionscript 1.0 To 2.0
I have a script that I would like to use that worked with Actionscript 1.0 but if I export using settings for Flash Player 8 (using either AS1.0 or AS2.0), it no longer works. It's a very simple script that has 5 lines in the main timeline and another 4 or 5 on one of the movie clips.

I export it as Flash player 5 it works and I change it over to Flash player 8, it doesn't do anything.

Is there a way to easily find out where my problem lies in Flash?

Thank your for your time.

Bob

Help - Converting JavaScript To ActionScript
How can I accommplish this...

<SCRIPT LANGUAGE="javascript">
function OpenWin(Loc) {
flashWindow=window.open(Loc,"wMessageWindow","tool bar=no,scrollbars=no,directories=no,resizable=yes, menubar=no,width=550,height=400");
flashWindow.focus();
}
</SCRIPT>

with actionscript.


What I need to do is open an HTML page from a link within a movie and I need that window to open with no scollbars, no menus ect.
[Edited by leakman on 09-27-2001 at 11:38 AM]

Converting Javascript To Actionscript
Hey there,

I am trying to convert javascript to actionscript to use on a website. It shows metric time, basically, but it was altered to show the current stardate in a game I play online. The website it is to be attached to will show people information on the game and I wanted to show the current stardate in the game. I have it working using javascript, but I can't for the life of me figure out what I am doing wrong converting it to actionscript(which I have done with other javascripts because I know js and as are basically the same).
Anyway, here is the whole HTML of the working javascript page. Any help would be appreciated.

<HTML>
<HEAD>

<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<BASE HREF="http://www.decimaltime.org/index.html">

<LINK REL="STYLESHEET" TYPE="text/css" HREF="/decimal.css" TITLE="decimal">
<STYLE type="text/css">
<!--

TEXTAREA { font-weight: bold; text-align=right; }
TEXTAREA, BODY, FORM, H1, H2, H3, TD, TH, P, DIV, CENTER, B, UL, CAPTION { font-family: Arial, Helvetica, sans serif }
PRE { font-family: New Courier, Courier, fixed-width }
HR { color:#000000; border-style:solid }
.blackborder {border:solid; border-color:black; border-width:2px}
//-->
</STYLE>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

function Clock() {
var Now = new Date();
var zone = Now.getTimezoneOffset();

// get Unix time, seconds since 1/1/70 00:00 UTC
var utime = Now.getTime()/1000;

// get Julian Date, GMT+1200
var jdtime = utime/0.0864 + 2440587500000;

// get Modified Julian Date, GMT
var mjdtime = utime/0.0864 + 40587000000 + 159914000000;

// get Internet Time, GMT+0100
itime = (utime+3600)/0.864;

// get local metric time
var ltime = 1000*(utime - 60*zone)/864;

// catch for browsers that use 2 or 3 digit years
var year = Now.getYear();
if (year < 1900) { year += 1900 }

// count day of year
if (navigator.appVersion.substring(0,1) > 3) {
var month = Now.getUTCMonth();
var doy = Now.getUTCDate();
} else {
var month = Now.getMonth();
var doy = Now.getDate();
}
var months = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
for (var i = 0; i < month; i++) doy += months[i];
if ((month >= 2) && (year % 4 == 0)) { doy++ } // add leap day

doy = (doy+1000).toString().substring(1,4);

// account for time zone offset
var offset = Now.getTimezoneOffset()/60 + Now.getHours();
if (offset > 23) { doy++ }
if (offset < 0) { doy-- }

// for Netscape, display in textarea box
if (navigator.appName == "Microsoft Internet Explorer") {
var br = "<BR>";
var minus = "&minus;";
var sp = "&nbsp;";
}
else {
var br = "
";
var minus = "-";
var sp = " ";
}

// put all dates and times in one string
timestring = " STD " + mjdtime.toString().substring(0,2) + +
mjdtime.toString().substring(2,6) + ":" +
mjdtime.toString().substring(6,9) + "." +
mjdtime.toString().substring(9,11) + br;



if (navigator.appName != "Microsoft Internet Explorer") {
document.forms[0].elements[0].value = timestring;
}
else if (document.layers) {
document.layers.clock.document.write(timestring);
document.layers.clock.document.close();
}
else if (document.all) {
clock.innerHTML = timestring;
}
setTimeout("Clock()", 10)
}

window.onload = Clock;

// End -->
</script>

<TITLE></TITLE>
</HEAD>

<BODY BGCOLOR=WHITE>
<FONT FACE="Arial, Helvetica">



<DIV ALIGN=JUSTIFY>

<TABLE WIDTH=100% BORDER=0>
<TR><TD VALIGN=TOP WIDTH=33%>
<FONT FACE="Arial, Helvetica">


</TD><TD VALIGN=TOP WIDTH=34% ALIGN=CENTER>

<TABLE><TR><TD VALIGN=TOP ALIGN=RIGHT>
<FONT FACE="Arial, Helvetica">

<SCRIPT>
/* code for lynx
<!-- </SCRIPT> <!-- -->
<PRE>


STD 52,061.719 380


</PRE>
<!-- */
// -->

<!--

if (navigator.appName != "Microsoft Internet Explorer") {
if (navigator.appVersion.substring(0,1) < "4") { var cols=25; var rows=7 }
else if (navigator.appVersion.substring(0,1) == "4") { var cols=12; var rows=7 }
else { var cols=10; var rows=6 }
document.write("<FORM><TEXTAREA COLS=",cols," ROWS=",rows," WRAP=NONE></TEXTAREA></FORM>");
} else {
document.write('<TABLE CLASS="blackborder" BORDER CELLSPACING=0><TR><TD ALIGN=RIGHT><B id=clock style="position:relative;"></B></TD></TR></TABLE>');
}

// -->
</SCRIPT>

</TD></TR></TABLE>



</TD></TR>
</TABLE>



</BODY>
</HTML>

Converting Car Engine Actionscript
Hello, I'm making a car game. My friend and I spent a long time putting together and modifying a car script to obtain what we have. When the car goes to the top of the screen, it reapeers at the bottom of the screen so it can continue driving. This is the script:


onClipEvent (load) {
h = _x;
v = _y;
hm = 0;
vm = 0;
wheelSpeed = 0;
actual_speed = 0;
ideal_hm = 0;
ideal_vm = 0;
tyreGrip = 1;
}
onClipEvent (enterFrame) {
// accelerating and braking
if (Key.isDown(Key.UP)) {
wheelSpeed += 10;
}
if (Key.isDown(Key.DOWN)) {
wheelSpeed += -5;
}
wheelSpeed *= 0.65;
ideal_hm = wheelSpeed*Math.cos(_rotation*(Math.PI/180));
ideal_vm = wheelSpeed*Math.sin(_rotation*(Math.PI/180));
hm += ((ideal_hm-hm)*tyreGrip);
vm += ((ideal_vm-vm)*tyreGrip);
h += hm;
v += vm;
// steering
if (Key.isDown(Key.LEFT)) {
_rotation -= Math.floor(actual_speed);
} else if (Key.isDown(Key.RIGHT)) {
_rotation += Math.floor(actual_speed);
}
actual_speed = Math.sqrt((hm*hm)+(vm*vm));
h = (h+800)%800;
v = (v+670)%670;
_x = h;
_y = v;
wheelSpeed *= .90;


***Sorry it's kind of long. But anyhow, this is my real problem. I got a friend to help me develop a script for adding in walls that stop the car. Although, this guy made a new car script for me. The thing is, I don't like the car script here as much, but I like the wall collision script in it (variable is 'wall'). Here it is:

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 1;
}
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
if (Math.abs(speed)>10) {
speed *= 1;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
speed *= .90;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.wall.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -0.4;
}
}


***Ok, so still with me?
When I put the following script on the end of my car script, it screws up and the the car kind of bounces against the wall.

if (!_root.wall.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -0.4;
}
}


If you could help me figure out how to make the wall collision smooth that would be amazing!!! If you'd like I could upload the .fla's so you could look at them. Thanks so much.

John

Help Converting Old Actionscript To Flash 8
Hello,

I have a menu i am trying to duplicate in the tutorial section - however it is obviously using an older version of flash - and i do not have the knowledge to convert using the correct syntax - i have tried to guess - but simply cannot debug any issues that arise.

below is the original code - any help in converting it would be appreciated beyond all belief. i am using Flash 8

thanks very much...

btw - is there a tool available on the web that helps convert old script?


Comment : ::::::::: Our constants ::::::
Set Variable: "TotalRubs" = 7
We'll need the height of the rub so we get it
Set Variable: "RubHeight" = GetProperty ("Rub",_height)
Then we input now the label we want for each rub (assuming we've got 7)
Note that all values of them are character string with ""
Comment : -----------------------------------------------
Set Variable: "LabelRub1" = "I"
Comment : -----------------------------------------------
Set Variable: "LabelRub2" = "am"
Comment : -----------------------------------------------
Set Variable: "LabelRub3" = "learning"
Comment : -----------------------------------------------
Set Variable: "LabelRub4" = "to"
Comment : -----------------------------------------------
Set Variable: "LabelRub5" = "create"
Comment : -----------------------------------------------
Set Variable: "LabelRub6" = "awesome"
Comment : -----------------------------------------------
Set Variable: "LabelRub7" = "menu"

Comment : ::::::::: Dupplicating part ::::::
let's always initialize our counter before "Loop" action :
Set Variable: "n" = 0
Do actions in loop as many time as our "TotalRubs" var
Loop While (nDO NOT FORGET to increase our counter !
Set Variable: "n" = n+1
Our var ("PosY") must be "dynamic" because there will be a different one for each rub.
you must fill three parameters (target, new name, depth).
Duplicate Movie Clip ("Rub", n, n*10)
We'll see later more about this "if condition"
If (n=1)
We define here the future position of our dupplicated movies
Set Variable: "YPosition" = 30
Else
Set Variable: "YPosition" = GetProperty (n-1, _y) + RubHeight
End If
At last, we set our "YPosition" var to our dupplicated movie
Set Property (n, Y Position) = YPosition
We set the corresponding label for each rub dupplicated
Set Variable: n&":Label" = eval ("LabelRub"&n)
End Loop
We don't need the original Rub MC, so we set to him an invisibility.
Set Property ("Rub", Visibility) = 0

Problems Converting Actionscript
Sorry to bother you with such an easy question but I'm a newbie. Why can't I use this script on a movieclip in Flash 8:

onClipEvent (load) {
this._y = -290;
y_final = 270;
y_start = -290;
x = 2;
}
onClipEvent (enterFrame) {
if (x == 2) {
y = this._y;
dx = (dx+(y_final-y)/20)/1.3;
y += dx;
this._y = y;
}
if (x == 3) {
y = this._y;
dx = (dx+(y_start-y)/40)/1.3;
y += dx;
this._y = y;
}
}

In Flash 5 it perfectly works - in Flash 8 it doesn't. Can you explain it to me and do you have a clue what I have to change

Thanxs in advance

[F8] Problem Converting Actionscript 1.0 To 2.0
Hi, I'm new to actionscript 2.0 never mind actionscript 1.0 so the following bit of code has stumped me entirely:

if (Number(myInit) == Number(FALSE)) {
// on first run make an array of all the text Y Pos.
while (Number(i)<=Number(endnum)) {
set("textY" add i, getProperty ("text" add i, _y ) );
i = Number(i)+1;
}
i = startnum;
myInit = TRUE;
}

These are the errors I get back when I publish the movie as flash 8:

**Error** Symbol=02 - textcol1, layer=scale actions, frame=2:Line 14: ')' or ',' expected
set("textY" add i, getProperty ("text" add i, _y ) );

**Error** Symbol=02 - textcol1, layer=scale actions, frame=2:Line 19: Unexpected '}' encountered
}

Total ActionScript Errors: 2 Reported Errors: 2

Can anybody shed some light on the matter?! Very confused...

Thanks

Converting Javascript To ActionScript
I am learning flash and converting a ajax site to flash. I am struggling with converting the functions that load the xml data (with an xmlproxy). Can someone help me convert one function? I think I can get all the remaining ones if I get this coded correctly.

*******Here is an example of the current code to load xml********

var dsProducts = new Spry.Data.XMLDataSet(null,"ProductSearch/Products/Product");


function loadQueryData()
{
var spryURL = 'includes/getXML.cfm?method=search&category=';
category = document.SearchForm.category.value;
srchString = document.SearchForm.query.value;
var url = spryURL + escape(category) + '&srchString=' + escape(srchString);
dsProducts.url = url;
dsProducts.loadData();
}

***********form button************
<input class="submit" type="button" id="SearchButton" name="SearchButton" value="Search" onclick="loadQueryData();" />
***********
I've tried many different ways to code (too many to include). Can someone help me get this correct in action script. Thank you in advance for your help!

Converting Actionscript 1.0 To 2.0 In Flash 8
Hi there,

Currently, I am developing game using Flash MX which i using Action Script 1.0. However, I have install Flash 8.

My question is, how am I to convert the my previous actionscript 1.0 to actionscript 2.0 in Flash 8?

Thanks.

Converting Flash 5 To Actionscript 2.0
I need to update a project by converting the following code from Flash 5 to Actionscript 2.0 Any help would be greatly appreciated.

on (press) {
startDrag("", false, 0, 0, 835, 0); /*width of dragable area*/
tellTarget (_root.player.dr) {
gotoAndPlay("drag");
}
tellTarget (_root.player.play) {
gotoAndStop(2);
}
}
on (release) {
stopDrag();
tellTarget (_root.player.dr) {
gotoAndPlay(1);
}
}

setProperty(_root.player.drag.dragMC, _x, math.floor(Number(getProperty(_root.player.movie, _currentframe))/Number(getProperty(_root.player.movie, _totalframes))*835));
/*width of play area*/
gotoAndPlay(_currentframe - 1);

tellTarget (_root.player.movie) {
gotoAndPlay(math.floor(Number(getProperty (_root.player.movie, _totalframes )) * (Number(getProperty (_root.player.drag.dragMC, _x )) * 0.01) / 8.35));
/*width of dragable area*/
if (Number(getProperty (_root.player.drag.dragMC, _x ))<5) {
gotoAndPlay(1);
}
}
gotoAndPlay(_currentframe - 1);

Converting A Jpeg To Swf In Actionscript?
What I am trying to do is convert a jpeg file to a swf before I use attachmovie() with it. So for example I could import the jpeg, convert it and then mess around with it and not have to look at ugly bitmap pixel effects . I have been trying to figure this out, though I don't really think there is a way to do it, but it would make my life so much simpler if there was.

Also I wanted to say hiya all!

I have read the forums for a while (~ 6 months ) on and off, but this was the first thing I wasnt able to find by searching for it.


Thanks alot.

Converting A Javascript Function To Actionscript
Does anyone know how to make this function an action on "release"?

onClick="this.style.behavior='url(#default#homepag e)';this.setHomePage(document.location.href);" onFocus="blur()"

I need to attach this function to a button but in flash...

Please help.

Thanks.

Converting Old Actionscript For Flash Player 5
Hi, im not a competant flash actionscripter and im making a musical piano and music program in flash.i got the original script from flashkit file.

im using code from another similar flash file, however it was written in flash 5, and it generates errors when i put into my file.

basically i have 16 keys on a keyboard, and an array called scale containing the names of the notes and an array called waveOffset with the offset values for each note. i also have a releaseRate value, decayLength value and attackRate value. i have not included the script for these values and arrays.

each piano has the following ASfile attached to it.


Code:
onClipEvent (load) {
// BOOLEAN TO TRACK IF NOTE IS PRESSED
notePressed = false;
// ATTACH THE SOUND IN LIBRARY TO THIS NOTE (MAPPED BY NAME FROM THE ARRAYS IN _ROOT
for (i=0; i<_root.scale.length; i++) {
if (_root.scale[i] == this._name) {
eval(_root.scale[i]) = new Sound(this);
eval(_root.scale[i]).attachSound("wave");
offset = _root.waveOffset[i];
}
}
// PLAY THE NOTE BEGINNING WITH NO VOLUME (-1 IS SMOOTHER THAN 0 FOR SOME REASON!)
function playNote () {
eval(this._name).setVolume(-1);
eval(this._name).start(offset, _root.decayLength);

}
// SET THE ATTACK RATE (VOLUME)
function setAttack () {
attackVolume = eval(this._name).getVolume();
if (attackVolume<(100-_root.attackRate)) {
eval(this._name).setVolume(attackVolume+_root.attackRate);
}
}
// SET THE RELEASE RATE (VOLUME)
function setRelease () {
releaseVolume = eval(this._name).getVolume();
if (releaseVolume<=100 && releaseVolume>_root.releaseRate) {
eval(this._name).setVolume(releaseVolume-_root.releaseRate);
}else{

eval(this._name).stop("wave");

}
}
}
// EVALUATE IF NOTE IS PRESSED AND SET ALPHA TO SHOW GREY BACKGROUND COLOUR UNDER NOTE (VISUAL FEEDBACK)
onClipEvent (mouseDown) {
if (hitTest(_root._xmouse, _root._ymouse, true)) {
notePressed = true;
playNote();
this._alpha = 0;
}
}
// SET NOTEPRESSED TO FALSE ON MOUSEUP
onClipEvent (mouseUp) {
notePressed = false;
this._alpha = 100;
}
// CONTINUALLY CALL ATTACK AND RELEASE METHODS TO CREATE ATTACK AND SUSTAIN ON EACH NOTE
onClipEvent (enterFrame) {
if (notePressed) {
setAttack();
} else {
setRelease();
}
}



if anyone can see what needs to be changed to get this to work with new flash (mx 2004 pro published in flash 6 player) i would greatly be appreciated. i understand it may take some time so if you are a busy person dont trouble yourself. just need some help.

Converting A Vector Into An Image Via Actionscript
Ok I was just wondering,
wouldn't it be great, to save swf filesize, if you could, at the start of the frame, change some vector movieclips into images.

This would save massive amounts of filesize because you don't need to embed the images, and also I/you could change your vector in flash without having to re-import the image...

Is there a way to do it with BitmapData or copying a movieclipt to a bitmap or something?

Is this possible and if so, how can i acheive it?
-Jacob

Help With Flash Player 6 Converting To 7 Actionscript
Hi guys, here's the problem. I have a simple hangman game that I downloaded and changed a bit to suit my needs (mostly design changes, not coding). This is going into a file that must be published (it would be muuuuch easier anyway) to flash 7 or greater. There is a function that allows you to click a letter and it will appear in the word, and it works fine in flash 6 (which is what it was published to by default...I think it's a few years old). But when I change the player to flash 7, the mouse function stops working. Everything else works fine, and it even will gray out the letter, but it is like it isn't receiving that mouse event.

Now I am probably a novice when it comes to actionscript, and I have looked EVERYWHERE for a code that could be causing the problem, and spent countless hours trying to figure it out. I've tried trace statements, changing names, etc. etc. Anyway here is the question for this ridiculously long post.

Can someone look at this file and tell me if they see something that would not work in flash player 7, but would in 6? It allows me to change the actionscript to version 2.0 and it doesn't seem to affect it. So it must be something related to the player version. Any help is greatly appreciated! Thanks!

Help Converting HTML Form To ActionScript
I just converted my site to Flash 8 but need help converting my list builder html form to ActionScript. Here it is:
__________________________________________________ ______________
<FORM ACTION="http://lb.bcentral.com/ex/manage/subscriberprefs.aspx" METHOD="POST">
<div align="center"><FONT color="#663300" SIZE="-1" FACE="arial, helvetica">
<STRONG>Register for Bonnie Sherman and Associates email updates</STRONG> </FONT> <BR>
<INPUT TYPE="TEXT" NAME="email" />
<INPUT TYPE="HIDDEN" NAME="customerid" value="26024" />
<INPUT name="SUBMIT" TYPE="SUBMIT" style="background-color:white;color:brown;font-weight:bold" value="Sign up" />
</div>
</FORM>
__________________________________________________ ______________

Because I am a newbie, if you could walk me through this like I was a sixth grader, I would appreciate it.

Converting Javascript To Actionscript On SWF Buttons
Greetings

OK... still new with AS. But I have a Website were you change the content of a DIV with a link. You do this with javascript:

Code:
function switchContent(obj) {

obj = (!obj) ? 'content1' : obj;

var contentDivs = document.getElementById('center').getElementsByTagName('div');
for (i=0; i<contentDivs.length; i++) {
if (contentDivs[i].id && contentDivs[i].id.indexOf('content') != -1) {
contentDivs[i].className = 'hide';
}
}
document.getElementById(obj).className = '';

}
Then I set the DIV's like so:

HTML Code:
<div id="center">
<!--start content1 - home -->
<div id="content1">
Content for id "content1" Goes Here </div>
<!--end content1 - home -->
<!--start content2 - info -->
<div id="content2" class="hide">
Content for id "content2" Goes Here </div>
<!--end content2 - info -->
<!--start content3 - work -->
<div id="content3" class="hide">Content for id "content3" Goes Here</div>
<!--end content3 - work -->
<!--start content4 - contact -->
<div id="content4" class="hide">Content for id "content4" Goes Here</div>
<!--end content4 - contact -->
<!--start bottom -->
<div id="bottom"></div>
<!--end bottom -->
</div>
<!--end content -->
Now getting this to work with a basic link like so:

HTML Code:
<a href="#" onClick="switchContent('content3'); return false;">link2</a>
...is no sweat, BUT when I try to place my custom Flash SWF file in there, no dice.

I suppose I need to place the event handlers (onClick) in the AS for the button file, but I'm not sure how to referance the Javascript file and all. Or do I just slap the same code as the javascript on an actions layer for the button with an onClick or onRelease event handler or something?

Any suggestions? Thanks in advance.

Converting Text To Shape (using Actionscript)
hi all. My question is this : Is it possible? Let's say i create a textfield(with some text in it ) and then i want to convertit to a shape. How would i do that + is it posssible to shape tween texts using nothing but actionscript?
thank you

Converting HTML Forms To Actionscript.
Hello,

I need to convert the below form - which is in HTML - to do the same thing in actionscript w/MX 2004. It is logging on to a firstclass server, so if you even have an example file of how this could work - that would be great.

Thanks

------------------------------------------------------------------------

<FORM name="LOGINFORM" action="http://mail.myserver.com/Login" target="blank" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return CMD5(this);">
<TABLE align="center" cellpadding="0" cellspacing="0" border="0">

<TD>&nbsp;</TD>
<TD><TABLE cellpadding="2" cellspacing="0" border="0">
<TR>
<TD><INPUT name="userid" type="text" tabIndex="1" size="10" maxlength="15"></TD>
<TD><INPUT type="password" name="password" size="10" maxlength="12" value="" tabIndex="2" onFocus="this.select();" onChange="sp=null;"></TD>

</TR>

----------------------------------------------------------------------

Help Converting To A Class Actionscript 3 Or Actionscript2
i downloaded this to http://www.braingiants.com/ can anyone convert this to external class.. as3 or as2 please anyone?

Converting Actionscript Animations Into A Movie
Hello all (1st post).

I have a fairly simple particle script that exists in frame 1 of an empty timeline. As the script runs its course, new particles are created dynamically, and move around on the Stage. I'm wondering if it's at all possible to export this animation into some sort of movie format.

The advantage of doing this would be to save processing power, I'd guess. I could have multiple movie instances of the movie animation playing in the background, instead of just running multiple instances of the script on the stage.

The export options in Flash don't seems to export animations that occur dynamically via actionscript. Is what I'm trying to do here impossible?

Converting Text To Shape (using Actionscript)
hi all. My question is this : Is it possible? Let's say i create a textfield(with some text in it ) and then i want to convertit to a shape. How would i do that + is it posssible to shape tween texts using nothing but actionscript?
thank you

Converting HTML Forms To Actionscript.
Hello,

I need to convert the below form - which is in HTML - to do the same thing in actionscript w/MX 2004. It is logging on to a firstclass server, so if you even have an example file of how this could work - that would be great.

Thanks

------------------------------------------------------------------------

<FORM name="LOGINFORM" action="http://mail.myserver.com/Login" target="blank" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return CMD5(this);">
<TABLE align="center" cellpadding="0" cellspacing="0" border="0">

<TD>&nbsp;</TD>
<TD><TABLE cellpadding="2" cellspacing="0" border="0">
<TR>
<TD><INPUT name="userid" type="text" tabIndex="1" size="10" maxlength="15"></TD>
<TD><INPUT type="password" name="password" size="10" maxlength="12" value="" tabIndex="2" onFocus="this.select();" onChange="sp=null;"></TD>

</TR>

----------------------------------------------------------------------

Converting Timeline Animation With Actionscript Tp Movie Clip
I have a timeline animation containing action script which I need to convert to a movie clip...simple we all say..but alas I have come up with a few problems..
when the layers are selected, I convert the timeline to a movie clip which is placed the library as normal.
When the oringal animation on the timeline is deleted and the converted movie clip is bought onto stage from the library......it fails to work.
I have tried upteen variations on this problem...but cannot solve therefore I need some help from you good people...
the .fla can be mailed to you for your opinion.
the reason I need the conversion is it is part of a preloader and the preloader interferes with the actionscript within the animation. therefore I need it to run as a movie clip....

thanks in advance

Converting ActionScript 1 To ActionScript 2
Flash keeps giving me a "type mismatch" error for this particular line of code:
myItemArray[x] = parseInt(Math.random()*9) + myItemArray[x];
Based on my research it's because it's old script and I'm not sure how to go about converting it so I don't get the error. I've pasted the entire block of code for your understanding. Thanks in advance for you help.

Code:
//Build array
myItemArray = new Array("a1","a2","a3","a4","a5","a6","b1","b2","b3" ,"b4","b5","b6");
for(var x = 0; x < 12; x++){
myItemArray[x] = parseInt(Math.random()*9) + myItemArray[x];
}
//Sort array
myItemArray.sort();
//Strip off random num at beginning
for (var x = 0; x < 12; x++){
myItemArray[x] = myItemArray[x].substr(1,myItemArray[x].length);
}

Converting Actionscript 1.0 To Actionscript 2.0
Last edited by funkyflash : 2006-01-18 at 11:06.
























This code goes in Frame 1:

ActionScript Code:
//          script by Jae Young, Choi
//            on Designers Forum (corea)
 
Movieclip.prototype.elasticScale = function(target, accel, convert) {
    xScale = xScale * accel + (target - this._xscale) * convert
    yScale = yScale * accel + (target - this._yscale) * convert
    this._xscale += xScale
    this._yscale += yScale
}


This code goes on the movieClip:


ActionScript Code:
onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        elasticScale(150, .75, 0.1)
        trace ("x=" + xscale)
        trace ("x2=" + (target - this._xscale))
    } else {
        elasticScale(100, .75, 0.1)
        trace ("x=" + xscale)      
        trace ("x2=" + (target - this._xscale))
    }
}

[CS3] Needs Help Converting Simple Flash 5 Actionscript 1.0 To Flash 8 Actionscript 2
Hi, can anyone help me convert this code to actionscript 2.0
I will separate it into the frames its on.

Frame 1
i = 1;
max = 60;
x = getProperty("fire", _x);

Frame 2
if (Number(i)<=Number(max)) {
duplicateMovieClip("fire", "fire" add i, i);
i = Number(i)+1;
}

Frame 3
if (Number(i)<=Number(max)) {
duplicateMovieClip("fire", "fire" add i, i);
i = Number(i)+1;
}
gotoAndPlay(2);

Thanks i appreciate any help

Converting A PDF To A Flash FLA File Without Converting To An Image First?
Basically, I'm building a digital catalogue that runs off a CD and uses a Flash 'page turning component' to display the pages. Certain pages will have links that use Flash's Fscommand call to open Word and Excel documents.

Has anyone got any bright ideas of how to Convert a PDF to a Flash FLA file without converting to an image first?

I know I can open a PDF in Photoshop, save as a PNG or JPG and then import this into Flash, however the quality isn't brilliant. If you use a hi-res image, then you get a hi-res file size...

Currently, the best way I have found, is to open the PDF in Illustrator, then export it as a SWF. Illustrator converts all text to shapes and you end up with a small SWF, yet great quality when displayed in larger sizes. As I'm currently using a page turning flash component that loads SWF files, I need the quality to be good for the 'Zoom' function.

I've found an Illustrator script that will do the hard work via a 'batch' process, so I can take a 100 page PDF and convert the whole lot to 100 SWF files while I drink tea and 'look busy' and read a magazine, but the problem I have is that I need to add a layer of buttons to several of the SWF files to add a little functionality....

I do have a SWF to FLA decompiler which does a good job, however because Illustrator turns everything into shapes, the decompiler does the same and you end up with thousands of files in the library.... Plus there are a lot of error messages when the file is first loaded...

Many layers are masked, (for some reason without a fill), so if you publish the decompiled file straight away, you just get a blank file. Once you go through and fill the masks needed, it shows when you publish, but this really is a lot of work and I've had a few pages that show when you open the SWF file, but don't show when the SWF is called into the page turning file.... Hmmm....

So in short, I'd like to take a PDF and convert it to a FLA file, add a layer of buttons and publish as a SWF file....

Anyone got any 'Pearls of Wisdom'?

Clere
Clere Print

Converting Input Text To Non-input With Actionscript
Is it possible to set a text field whose property is Input to Static Text with Actionscript?

Help Converting Vslider Mxml To Vslider Actionscript
Here is my problem: I'm converting a custom vsilder mxml code to actionscript code, so I can use it with the singleton design pattern.

The common code to both codes is the SliderThumb class:


Code:
package org.udesc.sherlockdengue.base
{
import mx.controls.sliderClasses.SliderThumb;

public class ZoomSliderThumb extends SliderThumb
{
public function ZoomSliderThumb()
{
super();
width=30;
height=30;
}
}
}
The mxml code is:


Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:VSlider xmlns:mx="http://www.adobe.com/2006/mxml"
height="125"
thumbDownSkin="@Embed('../resources/SliderThumb.png')"
thumbOverSkin="@Embed('../resources/SliderThumb.png')"
thumbUpSkin="@Embed('../resources/SliderThumb.png')"
sliderThumbClass="org.udesc.sherlockdengue.view.ZoomSliderThumb"
minimum="-1500" maximum="-500" value="-1000"
showDataTip="false"
change="zoom();"
creationComplete="labelZoom();">

<mx:Script>
<![CDATA[

import org.udesc.sherlockdengue.model.Viewports;
import org.udesc.sherlockdengue.model.CustomLabel;

private var viewport:Viewports = Viewports.getInstance();

private var label:CustomLabel;

public function zoom() : void
{
viewport.z_value = value;
}

private function labelZoom() : void
{
label = new CustomLabel("ZOOM");
label.x-=16;
label.y-=8;
addChild(label);
x = 580;
y = 195;
}

]]>
</mx:Script>

</mx:VSlider>
What I've managed to translate so far is:


Code:
package org.udesc.sherlockdengue.model
{
import mx.controls.VSlider;
import mx.controls.sliderClasses.SliderThumb;
import mx.core.UIComponent;
import mx.events.SliderEvent;

import org.udesc.sherlockdengue.base.CustomLabel;
import org.udesc.sherlockdengue.base.ZoomSliderThumb;

public class SliderButtons extends UIComponent
{
[Embed(source="../resources/SliderThumb.png")]
private var BigSliderThumb:Class;

private var label:CustomLabel;
private var custom_v_slider:VSlider;

public static var instance:SliderButtons;

public function SliderButtons()
{
if(instance != null)
{
throw(new Error("There can be only one instance of SliderButtons!"));
}

label = new CustomLabel("ZOOM");
label.x-=16;
label.y-=8;
addChild(label);

custom_v_slider = new VSlider();
custom_v_slider.addEventListener(SliderEvent.CHANGE, zoom);
custom_v_slider.minimum = -1500;
custom_v_slider.maximum = -500;
custom_v_slider.value = -1000;
custom_v_slider.height = 125;
custom_v_slider.showDataTip = false;
custom_v_slider.sliderThumbClass = ZoomSliderThumb;
custom_v_slider.x = 20;
custom_v_slider.y = 0;
addChild(custom_v_slider);

x = 580;
y = 185;
}

public static function getInstance() : SliderButtons
{
if(instance == null)
{
instance = new SliderButtons();
}
return instance;
}

public function zoom(event:SliderEvent) : void
{
Viewports.getInstance().z_value = custom_v_slider.value;
}
}
}
I tried a lot, but canīt load the .png image as the thumb in the actionscript code:


Code:
thumbDownSkin="@Embed('../resources/SliderThumb.png')"
thumbOverSkin="@Embed('../resources/SliderThumb.png')"
thumbUpSkin="@Embed('../resources/SliderThumb.png')"
This is the part I can't get converted to an actionscript file.

Help please!

Converting Flash 5 Tanmenu Actionscript To Flash MX
I have an old source file from mjau-mjau written in Flash 5. The script uses properties that when converted to flash player 6+ (AS1 and AS2) dont function properly.

Can anyone help me convert this cool menu system to flash MX?

FLA attached. (named TanMenu)

Thanks in advance...

Also, as advanced thanks and to proove Im not just a novice trying to get free scripting out of someone, please help yourself to an XML driven expanding menu Ive been working on (uses Lacos tweening prototypes) - feedback would be apreciated, its still in its infancy..

Converting Actionscript From Flash 4 To Flash Mx
does anyone know how to convert this scripts to flash mx from flash 4?

xX = getProperty("/h", _x)-50;
xoff = "515";
yoff = "325";
yY = getProperty("/h", _y)-50;
mainxX = "GetProperty ( "/main", _x )";
mainyY = "GetProperty ( "/main", _y )";
setProperty("/main", _x, Number(mainxX-xX)+Number(xoff));
setProperty("/main", _y, Number(mainyY-yY)+Number(yoff));
gotoAndPlay(4);




on (press) {
startDrag("/h", true, 500, 367, 675, 507);
}
on (release) {
stopDrag();
}

Converting Actionscript From Flash 4 To Flash Mx
does anyone know how to convert this scripts to flash mx from flash 4?

xX = getProperty("/h", _x)-50;
xoff = "515";
yoff = "325";
yY = getProperty("/h", _y)-50;
mainxX = "GetProperty ( "/main", _x )";
mainyY = "GetProperty ( "/main", _y )";
setProperty("/main", _x, Number(mainxX-xX)+Number(xoff));
setProperty("/main", _y, Number(mainyY-yY)+Number(yoff));
gotoAndPlay(4);




on (press) {
startDrag("/h", true, 500, 367, 675, 507);
}
on (release) {
stopDrag();
}

Converting Flash 5 Actionscript To Flash 7
Hi there,

I'm making a movie using actionscript 2.0 and I want to incorporate a Flash 5 movie into it, but obviously, this uses actionscript 1.0

I've got a version of the 'Tsunami' movie found on this sitehttp://www.flashkit.com/movies/Inter...6624/index.php which uses this code:
Code:
Movieclip.prototype.tsunamiLoad = function(identifier){
indexNum = identifier;
zDest = 50;
speed = 2;
}

Movieclip.prototype.tsunami = function(){
if (_parent.hitInProgress){
zDest = 100 - ((Math.abs(this._x - _parent._xmouse)/595) * 300);
} else {
zDest = 50;
}

if (zDest < 50){
zDest = 50;
}

this.swapDepths(zDest);
zDiff = zDest - this._xscale;
zMove = zDiff/speed;
this._xscale = this._yscale += zMove;

this._alpha = zDest;
}

/////////////////////
//Javascript Function
Movieclip.prototype.submitQuery = function(queryValue){
jsurl = 'javascript:submitQuery("' + queryValue + '")';
getURL(jsurl);
}
and it also has this code on the movie containing the tsunami
Code:
onClipEvent (enterFrame) {
if (!this.hitTest(_parent._xmouse,_parent._ymouse)){
hitInProgress = false;
} else {
hitInProgress = true;
}
}
and this code on the buttons
Code:
onClipEvent (load) {
tsunamiLoad(6);
}
onClipEvent (enterFrame) {
tsunami();
}
I'm really desperate to convert this to Actionscript 2.0 so that I can incorporate it into my new movie and still use my actionscript 2 code for the rest of the movie....

Can anyone help me out?.... please

Cheers

Rob

"Converting" Actionscript?
I have this actinscritp for a platformer that Im making:

Person that you move:


Code:
onClipEvent (load) {
jumping = false;
// jumping is true
speed = 0;
// speed is 0
//////////////////////
////Ammendment 1//
//////////////////
healthX = _root.health._x;
//sets healthX to the starting X postition of the "health" MC
scoreX = _root.score._x;
moneyX = _root.money._x;
percentX = _root.percent._x;
//sets scoreX to the starting X postition of the "score" MC
Xpos = this._x;
//sets Xpos to the starting X postition of this MC
Ypos = this._y;
//sets Ypos to the starting Y postition of this MC
////////////////
///////
maxmove = 15;
// maxmove is fifteen(max run seed)
_root.maxshoottime = 100;
// _root.maxshoottime is set to 100
// this is how far you want the bullets to travel before deleting
}
onClipEvent (enterFrame) {
//////////////////////
////Ammendment 2//
//////////////////
_x = Xpos-_root._x;
//sets the X pos to the starting X postition of this MC
_root.score._x = scoreX-_root._x;
//sets the scire MCs X pos to its starting point on the screen
_root.health._x = healthX-_root._x;
_root.money._x = moneyX-_root._x;
_root.percent._x = percentX-_root._x;
//sets the health MCs X pos to its starting point on the screen
if (!_root.ground.hitTest(this._x, this._y, true) && !jumping) {
// if NOT hitting X and Y postion with the ground and NOT jumping
this._y += 6;
// Y positon moves up 6
}
////////////////
///////
if (!_root.shooting) {
// if _root.shooting is false
_root.timer = 0;
// _root.timer is set to 0
_root.mvsp = _xscale/20;
// _root.mvsp is set to the chars xscale divided by 20
// the answer to this is the speed of the bullets
}
if (_root.dead) {
// if dead is true
this.gotoAndStop("dead");
// goto and stop on the "dead" frame
} else {
// otherwise (if they are not dead)
speed *= .85;
// speed is multiplied by .85
// the lower the faster is slows
if (dir == "right" && !_root.leftblock.hitTest(this._x+20, this._y, true)) {
_root.health._x += speed;
// moves the health, the opposite way to the _root
_root.score._x += speed;
_root.money._x += speed;
//LESSUR
_root.percent._x += speed;
//LESSUR
// moves the score, the opposite way to the _root
this._x += speed;
// moves the char, the opposite way to the _root
_root._x -= speed;
// moves the _root
}
//////////////////////
////Ammendment 3//
//////////////////
if (speed>0) {
//if speed is smaller than 0
dir = "right";
// the variable dir is set to right
} else if (speed<0) {
//if speed is greater than 0
dir = "left";
// the var dir is set to left
}
if (dir == "left" && !_root.rightblock.hitTest(this._x-20, this._y, true)) {
_root.health._x += speed;
// moves the health, the opposite way to the _root
_root.score._x += speed;
// moves the score, the opposite way to the _root
//LESSUR
_root.money._x += speed;
//LESSUR
//LESSUR
_root.percent._x += speed;
//LESSUR
this._x += speed;
// moves the char, the opposite way to the _root
_root._x -= speed;
// moves the _root
}
if (Key.isDown(Key.LEFT)) {
// if left is pressed
if (speed>-maxmove) {
// if the speed is greater than neg. maxmove
speed--;
// speed goes lower
}
this.gotoAndStop("run");
// goto and stop the run frame
this._xscale = -100;
// scale is set to neg. 100
// this is what rotates ur char
///////////////////
///////////////
} else if (Key.isDown(Key.RIGHT)) {
// otherwise if right is pressed
if (speed<maxmove) {
// if the speed is smaller than maxmove
speed++;
// speed goes up
}
this._xscale = 100;
// scale is set to 100
// this is what rotates ur char
this.gotoAndStop("run");
// goto and stop the run frame
} else if (Key.isDown(Key.CONTROL)) {
// otherwise if control is pressed
this.gotoAndStop("attack");
// goto and stop the attack frame
attacking = true;
// attacking is true
speed = 0;
// speed is set to 0
} else if (Key.isDown(Key.SPACE)) {
// otherwise if space is pressed
if (_root.gotgun == true && !_root.shooting) {
// if _root.gotgun is true(they have the gun) and _root.shooting is false
_root.attachMovie("bullet", "bulleter", 1, {_x:_root.char._x, _y:_root.char._y-47});
// attach the movie with the Linkage name "bullet" to the _root at the character X position and the Y position minus 25
_root.shooting = true;
// _root.shooting is set true
with (_root.bulleter) {
// all code below this code and it's closer refer to _root.bulleter
onEnterFrame = function () {
// setting the onEnterFrame events (onClipEvent)
if (_root.timer>_root.maxshoottime) {
// if _root.timer is smaller than _root.maxshoottime
_root.shooting = false;
// shooting is false
unloadMovie(this);
// this movie clip is unloaded
}
_root.timer++;
// _root.timer goes up 1
_x += _root.mvsp;
// the X goes up _root.mvsp (which is set constantly and stays the same when shooting.) };
};
}
attacking = true;
// attacking is true
speed = 0;
// speed is set to 0
this.gotoAndStop("shoot");
// goto and stop on the shoot frame
}
} else if (speed<1 && speed>-1 && !attacking) {
// if speed is smaller than one and greater than neg. 1
speed = 0;
// speed is set to 0
this.gotoAndStop("idle");
// gotoAndStop the idle frame
}
if (Key.isDown(Key.UP) && !jumping) {
// if up is pressed and NOT jumping
jumping = true;
// jumping is set true
}
if (jumping) {
// if jumping is true
this.gotoAndStop("jump");
this._y -= jump;
// Y position is set down jump
jump -= .5;
// jump is set down .5
if (jump<0) {
// if jump is smaller than 0
falling = true;
// falling is true
}
if (jump<-15) {
// if jump is smaller than neg. 5
jump = -15;
// jump is set to neg 5
// capping fall speeds prevents falling through grounds
}
}
if (_root.ground.hitTest(this._x, this._y, true) && falling) {
// if hitting X an Y postions with the ground and falling
jump = 12;
// jump is set to 9
jumping = false;
// jumping is false
falling = false;
// falling is false
}
}
}
onClipEvent (keyUp) {
// on Key Up
if (Key.getCode() == Key.CONTROL) {
// if the release is control
attacking = false;
// attacking is false
}
}

Now, this only works if exported in flash 6. How can i make it so i can export it in flash 8?

Converting SWF's...
Does anyone know of a way to convert .swf files to .fla?

Converting...
Hi all,

I'm trying to create some small animations from a .mov file supplied to us. The customer just wants a few scenes taken from it (door opening for 'Come on in' that sort of thing)

What is the best way of doing this? converting the .mov to jpgs and creating small movies...? Any suggestions welcome.

Thanks
Ash

Converting
how do u convert a flash movie into jpg or gif movie format? im trying to make an avatar and it wont let me make it a mov it just makes it a pic

Converting .fla's PC->MAC
im trying to solve a problem for which someone posted a file on these boards that is a solution. when i try and download it, i get a file.php type of deal. when i change the name to something.fla and then go to open it (using view all files) it says 'unexpected file fomat'. i tried using flash typer too but it doesnt help. im on a mac using flash 5.

m

Copyright Đ 2005-08 www.BigResource.com, All rights reserved