Changing Code From Flash 6 To Flash CS3
Hello everybody.
I found this xml-flash photo gallery made with flash 6 and Actionscript 2. But when I change the "publish setting" to Flash Player 9. it doesn't work properly and the images doesn't load.
Does anyone knows how to fix this?
I also would like to put all the layers and it's content into one Movie Clip symbol, since Im going to put it into a different file.
Thanks for your help.
I attached the source files
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-13-2007, 03:36 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[MX04] Changing The _y Value Twice; The Way Flash Executes Code; A Falling Mc.
Even though this problem is remotely game-related (scroller), The problem isn't so much; I figured I'd get a better response here.
This is a long-winded explaination, and the specifics aren't really needed, but my essensial problem is I am changing the _y in a mc twice consecutively in an enterFrame handler, and both changes are being shown, even though one happens after the other. So I guess my basic quesion is, Shouldn't the second change overrule the first? And if not is there any way to make it do so or get around it? I have tried to make variables ("x", "y"), manpulating those and at the very end of the handler, changing the _x and _y values to match the x and y variable, but the effect is still the same. Any insight as to why Flash is doing this(like it's Flash's fault... right) would be greatly apreciated!
Specifics:
My problem is something simply I though I'd encountered before, but apparently something is different. A movieclip is "falling" (parabolically, increasing speed as it falls), until it hits a "platform", at which point it stops. Because the mc is moving 15-20 pixels a frame, it can stop in the middle of the platform vertically, instead of seemingly resting on top. To fix this I just made it so that when the movieclip hit the platform at all, the y position would jump to just above the platform, so as to appear to rest on top. This works, but the mc is still half-way through the platform for one frame before popping up to it's correct place.
I'm working on a legit mx 2004 educationaly copy.
Thanks!
Files for 2004 and mx attatched, erroneously named becasue I didn't expect to get hung up so quickly
Flash Script? Is Writing Flash Code Possible? Without A Flash Builder Like Flash MX
I want to get into flash programming on my website, but i do not have thecash to buy flash MX 2004, it is 499 US thats a lot of money.
Basically what i want to know is, can flash be written as code, like HTML or do i need to buy a flash builder. And if so, what can i do about learning this code
Thanx from Fenton Multimedia Designs
Flash Script? Is Writing Flash Code Possible? Without A Flash Builder Like Flash MX
I want to get into flash programming on my website, but i do not have thecash to buy flash MX 2004, it is 499 US thats a lot of money.
Basically what i want to know is, can flash be written as code, like HTML or do i need to buy a flash builder. And if so, what can i do about learning this code
Thanx from Fenton Multimedia Designs
Changing Code
I have 24 identical mc's in my movie. I want to add independent code to each one. Is there a way to make each object seperate, but still making changes in the code to all of them at the same time?
Help Changing This AS Code Into AS 2
hello all.
i need a little help here.
i have this AS but when i change the publish settings into flash 7 and/or action script 2 the code stops working.
please help
Code:
movieClip.prototype.desliza = function(x, y, speed) {
var mc_control;
if (this.slideControl) {
mc_control = this.slideControl;
} else {
mc_control = this.createEmptyMovieClip("slideControl", this.depth++);
}
mc_control.targetY = y;
mc_control.targetX = x;
mc_control.speed = speed;
mc_control.onEnterFrame = function() {
this._parent._y += (this.targetY-this._parent._y)/this.speed;
this._parent._x += (this.targetX-this._parent._x)/this.speed;
if (Math.abs(this.targetY-this._parent._y)<0.2 && Math.abs(this.targetX-this._parent._x)<0.2) {
this._parent._y = this.targetY;
this._parent._x = this.targetX;
this.removeMovieClip();
}
};
};
var acceleration = 6;
var friction = .8;
menu.checkDistance = function() {
if (Math.abs(this.targetX-this._x)<0.2 && Math.abs(this.targetY-this._y)<0.2) {
if (Math.abs(this.xspeed)<0.2 && Math.abs(this.yspeed)<0.2) {
this._x = this.targetX;
this._y = this.targetY;
delete this.onEnterFrame;
}
}
};
menu.moveToMouse = function() {
var xdif = this.targetX-this._x;
var ydif = this.targetY-this._y;
this.xspeed += xdif/this._parent.acceleration;
this.yspeed += ydif/this._parent.acceleration;
this.xspeed *= this._parent.friction;
this.yspeed *= this._parent.friction;
this._x += this.xspeed;
this._y += this.yspeed;
this.checkdistance();
};
then inside a movie clip that is on the root timeline when clicked i call this
Code:
on (release) {
_root.carga.attachMovie("cover", "cover_dinamico", 1);
_root.carga._x = 400;
_root.carga._y = 300;
this.onEnterFrame = _parent.fondo.desliza(-600, 250, 15);
this.targetX = 12;
this.targetY = 120;
this.onEnterFrame = this.moveToMouse;
}
with the original settings (Flash player 6 and ActionScript 1) works just fine, the problem is that i need to use "MovieClipLoader" and only works with AS 2.
So thats my problem.
Please help
Thanks in advance.
Changing Over Code From AS 2 To 3
I have my entire application written using actionscript 3.0, but I can't seem to figure out how to use URLLoader in the same way that I used LoadVars in AS 2. Is there anyone out there that can help me convert this code to do the same operation, but in AS 3? (This code is loading an external txt file to load button hyperlinks in my application.)
Any help would be much appreciated!
Code:
newURL = new LoadVars();
newURL.onLoad = function(success) {
if (!success) {
trace("FAILED TO LOAD");
}else{
//do whatever you want to happen IF successful
trace(newURL.link1); //newURL = your textFile & link = variable in text file
webSite = newURL.link1;
//set button code
button1.onPress = function() {
getURL(webSite);
}
}
};
newURL.load("someTextFile.txt");
Changing Code Into AS3
I have a code that I wrote in AS2 and I am now trying to convert it into AS3 . . . When I converted it this is what I came up with but I can still not get it to work.
Can someone help me fix it? I used a coverter for some of it http://www.5etdemi.com/convert/index.php . . . does anyone know of a better one?
Thanks for any help fixing the code
Attach Code
import flash.display.Stage;
sW = stage.stageWidth;
sH = stage.stageHeight;
background1.width = sW
background1.height = sH
var stageL:Object = new Object();
stageL.onResize = function() {
sW = stage.stageWidth;
sH = stage.stageHeight;
background1.width = sW
background1.height = sH
};
Stage.addListener(stageL);
Edited: 12/08/2007 at 10:49:04 PM by bcounts
Changing This Code Around...
Hey all...
I've got a question for you and following this note there will be a long ace code sample that I'd like to see if anyone can help me with...
It's the Flash 8 style image gallery thumbnail viewer and i'd like to make some modifications.
As you'll see, I've tried to "attachMovie" for the thumbnail holder instead of "createMovieClip" because I want to be able to edit each one of the thumbnail holder mc's. Furthermore, I don't actually want to see the thumbnail at all, just what I've done in the attached movie... you've seem this im sure on some site where for each image it's just a circle and when you click on it, then it loads it's larger form... Here's the code:
ActionScript Code:
main_menu.boton1._visible = false;main_menu.boton2._visible = false;main_menu.boton_reset._visible = false;////////////////////////////////////////////////////////////////////////////////////xmlData = new XML();xmlData.ignoreWhite = true;xmlData.onLoad = loadXML;function loadXML(loaded) {if (loaded) {xmlNode = this.firstChild;image = [];description = [];thumbnails = [];_global.total = xmlNode.childNodes.length;for (i=0; i<total; i++) {image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;thumbnailer(i);}firstImage();} else {trace("file not loaded!");}}xmlData.load("images.xml");/////////Load First Image Function///////////////////////////////////////////////function firstImage() {if (loaded == filesize) {picture._alpha = 0;picture.loadMovie(image[0], 1);desc_txt.text = description[0];}}/////////Image Preloader Function//////////////////////////////////////////////////////p = 0;this.onEnterFrame = function() {filesize = picture.getBytesTotal();loaded = picture.getBytesLoaded();preloader._visible = true;if (loaded != filesize) {preloader.preload_bar._xscale = 100*loaded/filesize;} else {preloader._visible = false;if (picture._alpha<100) {picture._alpha += 10;}}};//////////Load clicked thumbnail Image Function////////////////////////////////////////////////function callImage() {if (loaded == filesize) {picture._alpha = 0;picture.loadMovie(image[p], 1);desc_txt.text = description[p];}}//////////Thumbnail maker///////////////////////////////function thumbnailer(k) {loaded_counter = 0;total_thumbs = _global.total;var container = thumbnail_mc.createEmptyMovieClip("th"+k, thumbnail_mc.getNextHighestDepth());container._visible = false;container._alpha = 0;var image = container.createEmptyMovieClip("img", container.getNextHighestDepth());tlistener = new Object();tlistener.onLoadInit = function(target_mc) {target_mc.pictureValue = k;target_mc.onRelease = function() {p = this.pictureValue;callImage();};target_mc.onRollOver = function() {this._alpha = 50;};target_mc.onRollOut = function() {this._alpha = 100;};loaded_counter++;counting_txt = loaded_counter;if (loaded_counter == total_thumbs) {main_menu.boton1._visible = false;main_menu.boton2._visible = false;grid_maker_01();}};image_mcl = new MovieClipLoader();image_mcl.addListener(tlistener);image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k+".img");}///////////Layout Functions/////////////////////////////////////////////////////////////////////MovieClip.prototype.grid_maker_01 = function(f) {num = 0;col = 4;row = 3;scale = 60;space = 5;for (l=0; l<col; l++) {for (j=0; j<row; j++) {if (num<_global.total) { with (eval("this.thumbnail_mc.th"+num)) { _x = ((_width+space)*scale/100)*l; _y = ((_height+space)*scale/100)*j; _xscale = _yscale=scale; _visible = true; } num++;}}}this.cascader();};//////////////////////////////////////////////////////////////////////////////////MovieClip.prototype.cascader = function() {inter = 300;c = 0;delayed_fade = function () {if (c<_global.total) {with (eval("this.thumbnail_mc.th"+c)) { fadein();}c++;} else {main_menu.boton_reset._visible = true;clearInterval(delay);}};delay = setInterval(delayed_fade, inter);};///////////////////////////////////////////////////////////////////////////////MovieClip.prototype.fadein = function() {this.onEnterFrame = function() {if (this._alpha<100) {this._alpha = this._alpha+5;} else {this._alpha = 100;delete this.onEnterFrame;}};};///////////////////////////////////////////////////////////////////////////////////////MovieClip.prototype.positioner = function(xDest, yDest, rDest, aDest) {this.onEnterFrame = function() {this._x = xDest-(xDest-this._x)/1.2;this._y = yDest-(yDest-this._y)/1.2;this._alpha = aDest-(aDest-this._alpha)/1.2;this._rotation = rDest-(rDest-this._rotation)/1.2;if ((Math.abs(xDest-this._x)<=1) and (Math.abs(yDest-this._y)<=1)) {delete this.onEnterFrame;this._x = xDest;this._y = yDest;this._alpha = aDest;this._rotation = rDest;}};};//////////////////////////////////////////////////////////////////////////////////MovieClip.prototype.grid_maker_02 = function() {t = 0;num = 0;col = 3;row = 4;scale = 80;space = 10;x_offset = 100;y_offset = 0;inter = 300;function array_maker() {_global.j_array = new Array();_global.l_array = new Array();for (l=0; l<row; l++) {for (j=0; j<col; j++) { r = _global.j_array.push(j); q = _global.l_array.push(l);}}}array_maker();function mover() {if (t<_global.total) {n = _global.j_array[t];m = _global.l_array[t];with (eval("this.thumbnail_mc.th"+t)) { xD = x_offset+((_width+space)*scale/100)*n; yD = y_offset+((_height+space)*scale/100)*m; rD = 0; aD = 100; _xscale = _yscale=scale; _visible = true; positioner(xD, yD, rD, aD);}} else {clearInterval(delay2);main_menu.boton_reset._visible = true;}t++;}delay2 = setInterval(mover, inter);};/////////////////////////////////////////////////////////////////////////function reset() {for (d=0; d<_global.total; d++) {with (eval("this.thumbnail_mc.th"+d)) {_x = 0;_y = 0;_alpha = 0;_xscale = 100;_yscale = 100;_rotation = 0;visible = false;}}}
Thanks so much in advance... I've spent too many hours in vein. I need your skillz!
Help Changing Code...
Hey, I used this http://www.kirupa.com/developer/mx/hitcounter.htm tutorial to add a counter to my game, but I need to change the code to use the loadVars class.
Im not sure how to make the proper changes, can someone please help me out? I really appreciate it.
Changing The Tint Through Code
I want an mc to start tinted as a certain color, and gradually become untinted as the user answerw questions right. Is there any way to do this using code?
Changing A Date Code
hey guys, hoping someone can help me edit this easily.
I have 2 text fields that will show a current date (no time) and a future date (also no time) six weeks from the present date. It is for an expiration card.
first text field works fine. On my second text field it works to a point, it shows the date plus 42 days added to it
i.e. Wednesday, May 22 2004 (textfield 1)
Wednesday, May 68 2004 (textfield 2)
I want it read 42 days in advance i.e. Thursday, June 30 2004 or whatever it turns out to be.
heres the AS for the 2nd field
function howlong(arg) {
if (length(arg)==1) {
arg = "0" + arg;
return arg;
}
else {
arg = arg;
return arg;
}
}
myDate = new Date();
daytext = myDate.getDay();
dd = myDate.getDate();
totaldd = dd+(42);
mm = myDate.getMonth();
yyyy = myDate.getFullYear();
switch (daytext) {
case 0: daytext = "Sunday";
break;
case 1: daytext = "Monday";
break;
case 2: daytext = "Tuesday";
break;
case 3: daytext = "Wednesday";
break;
case 4: daytext = "Thursday";
break
case 5: daytext = "Friday";
break;
case 6: daytext = "Saturday";
break
}
switch (mm) {
case 0: mm = "January";
break;
case 1: mm = "February";
break;
case 2: mm = "March";
break;
case 3: mm = "April";
break;
case 4: mm = "May";
break
case 5: mm = "June";
break;
case 6: mm = "July";
break
case 7: mm = "August";
break
case 8: mm = "September";
break
case 9: mm = "October";
break
case 10: mm = "November";
break
case 11: mm = "December";
break
}
six_weeks = (daytext + "," + totaldd + " " + mm + " " + yyyy)
what the heck am I missing?????????????
major thanks for helping me out
Russ
Changing Someone Elses Code
Hi I have a file that some one else did... I am new to flash and I am trying to alter it. their code looks like this
for(i=0; i<itemNum; i++) {
_root.attachMovie("mc_button","mc_button"+i,10+i);
ref = _root["mc_button"+i];
// Vertical Positión (_y)
ref._y = stageHeight/2+10;
// Horizontal Positión (_x) + separation (20px)
ref._x = ( space * i ) + separation;
// Loads the picture description
ref.picName=picturesXML.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue
// unloads the marc
ref.marc.marc.unloadMovie()
// Load the picture(.jpg)
ref.marc.marc.loadMovie(picturesXML.firstChild.chi ldNodes[i].childNodes[1].firstChild.nodeValue)
trace ("1"+picturesXML.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue);
// Large Picture URL
//ref.picURL=picturesXML.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue
// ID
ref.ID=i
}
I am unable to determine what the line _root.attachMovie("mc_button"
means what is "mc_button" and where can I find it in my movie also what is ref.marc.marc.loadMovie.
I know loadMovie is loading a movie... in this case an image but what does the ref.marc.marc have to do with anything
thanks.
No Flash And No Embed Code In Source Code?
I really dont know whats going on here, when i try to embed my flash into a html or php document the flash movie does not appear when browsing, when i view source the code is not even there but all other code changes are reflected (i know the document has been updated). When i go direct to the swf url I can see the file. when i publish the swf with html it works fine locally but again online i cant even see the code. other flash files work fine on my site, this is a problem on IE and firefox.. whats going on???????
Changing The Behavior Of Objects Using Code
Can the behavior of Objects be changed dynamically using ActionScript. Meaning can we change a button to a movieClip using Script during runtime. if so, how?
regards
shape_5555@yahoo.com
Changing Color By Time Code?
Ok heres a new problem ,
im looking to change a color in a movieclip over time so if the hour is "0" the rgb will 003366 etc and it changes every hour, plus another layer on top in a different movie movieclip over top in the main frame changes a light and dark transparency in alpha over time. so if hour ="0" movieclip_alpha = 50 or something like that
hope hope you can help me out.
thanks
sam
akaeadsam
Problem With Changing Code On Component
Hi everyone
heres my problem, I drug 5 image fader components into my movie and I gave them all different instance names. However, when I go into the movie explorrer to manipulate the code for one of the instances, it changes the code on all of them. Does anyone know how I can just change one instance componant at a time.
Ter
Changing The Draw Api Of This Code To A Circle
I have been searching for a way to implement a circular draw api code into this script(was obtained in this forum) for awhile now and nothing seems to work. Does anyone know of how to do this? Here is the posted code, but with squares:
Code:
// create mc that will contain all the squares
mask = _root.createEmptyMovieClip("maskMC",1);
// square size
size = 20;
// init
c=0;
r=0;
// wait however long before squares disapear (in frames)
stallFor=20;
for (i=0; i<560; i++){
// create square mc
mc = mask.createEmptyMovieClip("mc"+i,i);
// draw the square
mc.lineStyle(1,0x000000,0);
mc.beginFill(0x999999,100);
mc.moveTo(0,0);
mc.lineTo(0,size);
mc.lineTo(size,size);
mc.lineTo(size,0);
mc.lineTo(0,0);
mc.endFill();
// position the square
mc._x = r * size;
mc._y = c * size;
// set random properties for movement scaling etc
mc.delay = stallFor + r;
mc.rot = random(20) - 10;
mc.scaler = random(6)+6;
mc.mvx = random(5)+2;
mc.mvy = random(20)-10;
// set on enterframe function for the square
mc.onEnterFrame = function(){
if (!this.delay) {
// do movements
this._rotation += this.rot;
this._xscale = this._yscale -= this.scaler;
this._x -= this.mvx;
this._y -= this.mvy;
if (this._xscale < 0) {
// remove it when we are finished with it
this.removeMovieClip();
} else {
this._alpha-=this.scaler/2;
}
} else {
this.delay--;
}
}
// sort out position in grid
if( c<19 ){
c++;
}else{
c=0;
r++;
}
}
Any help at all would be greatly appreciated.
Dynamically Changing BG Color With Code.
Alright, so I was wondering if it is possible to dynamically change the BG color of a page using some sort of scripting language (XML?).
What I want to happen is that I have say 3 buttons on the top, a blue one, a red one and a green one. Now, on release of each of those buttons, I have a different theme to my site, blue, red and green respectively.
What I'm looking for is that the HTML page the .swf is embedded in to read some code segment and alter the bgbody color to match that specified in my code.
Is there a way to do this 'cross-communication'?
Thanks,
DaVULf
[F8] Changing Code To Function Breaks It
Hi there, I'm trying to make this piece of code (that takes a jpg/gif turns it into bitmap data, and tiles it BEHIND everything else) into a function, so I can call it with different parameters (such as img url, description etc.).
This is the code inline, that works perfectly:
code:
initialLoad("loading wallpaper...");
img = "./images/bg.gif"
this.createEmptyMovieClip("tile_mc", this.getNextHighestDepth());
//trace(this.getNextHighestDepth());
loader = new MovieClipLoader()
loader.addListener(this)
loader.loadClip(img, _root.tile_mc)
function fillBG() {
this.beginBitmapFill(myBitmap);
this.moveTo(0,0);
this.lineTo(Stage.width,0);
this.lineTo(Stage.width,Stage.height);
this.lineTo(0,Stage.height);
this.lineTo(0,0);
this.endFill();
}
function onLoadInit() {
updateLoad("wallpaper loaded.");
myBitmap = new BitmapData(tile_mc._width, tile_mc._height,true,0x00FFFFFF)
myBitmap.draw(tile_mc)
tile_mc.removeMovieClip()
fillBG();
}
function onLoadError() {
tile_mc.removeMovieClip()
}
fillBG();
var stageL:Object = new Object();
stageL.onResize = function() { fillBG(); }
Stage.addListener(stageL);
Now this code is my attempt at modifying it to a function (just adding function x(), and closing {, then calling it)
code:
function loadTile() {
initialLoad("loading wallpaper..."); //changes text for preloader
img = "./images/bg.gif" //url to image
this.createEmptyMovieClip("tile_mc", this.getNextHighestDepth());
//trace(this.getNextHighestDepth());
loader = new MovieClipLoader()
loader.addListener(this)
loader.loadClip(img, _root.tile_mc)
function fillBG() {
this.beginBitmapFill(myBitmap); //this code tiles the bitmap
this.moveTo(0,0);
this.lineTo(Stage.width,0);
this.lineTo(Stage.width,Stage.height);
this.lineTo(0,Stage.height);
this.lineTo(0,0);
this.endFill();
}
function onLoadInit() {
updateLoad("wallpaper loaded.");
myBitmap = new BitmapData(tile_mc._width, tile_mc._height,true,0x00FFFFFF)
myBitmap.draw(tile_mc)
tile_mc.removeMovieClip()
fillBG();
}
function onLoadError() {
tile_mc.removeMovieClip()
}
fillBG();
var stageL:Object = new Object(); //this is a listener for when it resizes
stageL.onResize = function() { fillBG(); }
Stage.addListener(stageL);
}
loadTile();
Now the first code works perfectly, the second loads the bitmap ABOVE everything else, and doesn't tile.
I can't figure out what it is - any ideas?
Many thanks, look forward to some help - all help so far has been great! love you ALL!
Code Not Changing X,z, Load Position, ? Why?
With the highlighted lines I'm trying to change the position on the page that the .swf loads to. This is the button code that calls up the external .swf.
Any help?
}
on(release){
loadMovieNum ("scroller1.swf",1);
_root.onEnterFrame = function(){
if (_level1 != undefined){
_level1._x = 300;
_level1._y = 200;
delete _root.onEnterFrame;
}
}
}
Changing Order Of Code Execution
Hi.
I've created a movieclip with some functions within it. And I've placed this movieclip on the stage, and then I try to execute those functions from the stage. This is where I run into a problem.
Flash builds the code on the _root level first, then it builds code inside of the movieclip.
I want to build the code within the movieclip before the code on the main timeline is run. I'll try to illustrate:
ActionScript Code:
// On frame one in my .fla
// The movieclip where everything is placed is called mc_ball
mc_ball.setPosition(200,300);
// In mc_ball movieclip
function setPosition(x:Number, y:Number) {
this._x = x;
this._y = y;
}
I've tried to use #initclip, but that doesn't work either - because then it executes the code as if it was executed from _root. In that case, "this._x = x;" would translate to "_root._x = x", which obviously isn't the solution I'm looking for.
Does anybody know how to solve this problem?
Thanx
Simple Code For Changing Frames
i need a simple code to change frames..
something like this..
when i release the button(pictures_btn, movies_btn..) - go to frame named(pictures, movies, news..)
btw.. im using flash MX 2004..
many thanks
Tsunami Links - Changing Code...
I found and modified this code, to work with my menu list.... the tsunami effect kinda works, but the range in which the link items are enlarged is too small... is there any part of the code I can modify to make the rolling less dramatic and effect more of the links??
Code:
var colnum:String = "1";
var numberofItems:Number = 8;
var filledSpace:Number = 0;
var gapspace:Number = 0;
var alpha:Number = 100;
//Hit Test with Bounding Box Check...
hitSuccess = function (){
if(this._parent["boundbox"+[colnum]].hitTest(_root._xmouse,_root._ymouse)){
for(i=startnum ; i <= endnum ; i++) {
myDif = yPos[i] - (this._parent._ymouse - 25);
// percentage increase
scaleAmount = Math.max (150-((myDif*myDif)/16), 100) ;
alphaAmount = Math.max (100-((myDif*myDif)/6), 50) ;
if (alphaAmount < alpha) {
alphaAmount = alpha;
}
if (scaleAmount < 100) {
scaleAmount = 100;
}
this["text" + i]._xscale = scaleAmount;
this["text" + i]._yscale = scaleAmount;
this["text" + i]._alpha = alphaAmount;
}
// *** add up total Y pixels taken by text ***
for (m=startnum ; m <= endnum-1 ; m++) {
filledSpace = filledspace + this["text" + m]._height;
}
// *** find total Y pixels not taken by text
totalheight = this["text" + endnum]._y - this["text" + startnum]._y;
gapSpace = totalheight - filledspace;
avgDistance = gapSpace / numberofitems;
m = startnum + 1;
for (m ; m <= endnum-1 ; m++) {
this["text" + m]._y =(this["text" + (m - 1)]._y + this["text" + (m - 1)]._height) + avgdistance
}
} else {
// *** shrink text back when mouse rolls out
i = startnum;
for (i ;i <= endnum ; i++) {
if (Math.round(this["text" + i]._yscale) >= 100) {
// return scale back to original state
this["text" + i]._yscale = Math.round ( this["text" + i]._xscale ) - 2;
this["text" + i]._xscale = Math.round ( this["text" + i]._yscale ) - 2;
}
if ( this["text" + i]._y < yPos[i]) {
// return y position back to original state
this["text" + i]._y = Math.round ( this["text" + i]._y ) + 2;
}
if ( this["text" + i]._y > yPos[i]) {
this["text" + i]._y = Math.round ( this["text" + i]._y ) - 2;
}
if ( this["text" + i]._alpha > alpha) {
this["text" + i]._alpha = Math.round ( this["text" + i]._alpha ) - 2;
}
}
}
}
hitSuccess();
Random Loading, Help With Changing This Code
Hello,
This code works. However. I'm curious how I would change it so that I could load random movieclips, that are in the current library of the movie I'm loading into?
Filenames?
What would the path be?
filename = ["imageone.swf", "imagetwo.swf", "imagethree.swf"];
path = "";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], randomphotos);
Code For Changing Stage Dimensions?
Well, the title sums it up pretty well... Is there some action script I can use to adjust the actual dimensions (width and height) of the stage while my flash movie is running?
My project: I just got a mac mini and I'm currently learning how to make Mac Dashboard Widgets. Since I only know how to do flash - that's what I'm using. Unfortunately, the mac dashboard does not support transparent backgrounds for swfs. Hence, it would be nice if I could have the actual stage dimensions change according to the dimensions of my movie clip (in my current project) - maybe this will create the illusion of a transparent background?
Thanks for all your answers.
[MX04] Open A New Link In Html By Clicking Button In Flash (no Code In Flash).
Hi,
I'm facing problem while opening a new html window by clicking button created in flash.
For this i don't want to write single code in flash but want to handle this through the html only.
For this I have used <embed> tag to add swf file in html. but could not add click code in HTML on that button.
Could any one help me out?
Changing This Code To Make An Array Do The Work?
I have a document where by you can access stats for a character in a game by clicking on a button next to them which takes you to their stat page, there are 2 characters in all. As this is an assignment i was meant to use an Array to populate the text boxes in the stats pages but instead i have used Object.
How would i be able to alter my code so that it populates the text boxes though with an Array instead?
Here is the code:
var gryzzleStats:Object = {name:"LekChewer", power:200, weapon:"Tedium", ally:"PawPint", nemesis:"T'Deen", skill:"Sarcasm", mortality:"High"}
var molochStats:Object = {name:"ChewTa", power:250, weapon:"Graydz", ally:"VoidKa", nemesis:"T'Deen", skill:"Chewting", mortality:"Medium"}
function setStage() {
this.attachMovie("select", "select", 1);
this.select._x = 250;
this.select._y = 200;
this.attachMovie("back", "back", 5);
this.back._x = 70;
this.back._y = 25;
this.back._visible = false;
this.select.b1.createCharacter = createCharacter;
this.select.b1.onRelease = function() {
this.createCharacter("gryzzle", gryzzleStats);
}
this.select.b2.createCharacter = createCharacter;
this.select.b2.onRelease = function() {
this.createCharacter("moloch", molochStats);
};
this.back.onRelease = function() {
setStage();
removeMovieClip(this._parent.text1);
removeMovieClip(this._parent.moloch);
removeMovieClip(this._parent.gryzzle);
this._visible = false;
};
}
function createCharacter(name:String, stats:Object) {
this._parent._parent.attachMovie(name, name, 3);
this._parent._parent[name]._x = 450;
this._parent._parent[name]._y = 328;
this._parent._parent.attachMovie("text1", "text1", 4);
this._parent._parent.text1._x = 40;
this._parent._parent.text1._y = 80;
this._parent._parent.text1.l7.text = stats.name;
this._parent._parent.text1.l1.text = stats.power;
this._parent._parent.text1.l2.text = stats.weapon;
this._parent._parent.text1.l3.text = stats.ally;
this._parent._parent.text1.l4.text = stats.nemesis;
this._parent._parent.text1.l5.text = stats.skill;
this._parent._parent.text1.l6.text = stats.mortality;
this._parent._parent.back._visible = true;
removeMovieClip(this._parent);
}
setStage();
I would appreciate any help,
Thanks.
Movie Not Changing Out According To Time (code Attached)
I have had help from severla of you (gparis in particular (thank you)) to try and get this code to work....
I feel it is so close...
the point is to change the swf out according to the time
Here it is thus far:
hoursArray = new Array("barmenu", "barmenu", "breakfast", "breakfast", "breakfast", "breakfast", "breakfast", "breakfast", "breakfast", "breakfast", "breakfast", "lunch", "lunch", "lunch", "barmenu", "barmenu", "happyhour", "happyhour", "dinner", "dinner", "dinner", "dinner", "happyhour", "happyhour");
_root.createEmptyMovieClip("myClip", 1);
function changeMenu() {
localHours = myDate.getHours();
if (hoursArray[localHours]!== oldHour) {
// if not the same movie then load the new one
loadMovie(hoursArray[localHours]+".swf", myClip);
oldHour = hoursArray[localHours];
} else {
// do nothing
}
}
// Set an interval to update the menu once per minute.
myInterval = setInterval(changeMenu, 60000);
// Load the first .swf, otherwise you will wait for one minute until the setInterval does it.
var myDate = new Date();
var localHours = myDate.getHours();
var oldHour = hoursArray[localHours];
loadMovie(oldHour+".swf", myClip);
It loads the swf according to the time, but does not change when the next menu is set to appear...
any ideas???
Changing From Embedding Code In Clips To Doing It On The Timeline.
Hello there.
Like a lot of less advanced users, the changes between AS2 and AS3 are causing me no end of frustration. Being more of a designer than a programmer, I've always handled Actionscript by applying actions directly to the clip, thus I have no experience with listeners and frankly have absolutely no idea how they even work.
The technique laid out in this tutorial is one that I've frequently used in projects in the past. However, due to it's reliance on applying code to the object itself means it doesn't work in AS3.
So I'm wondering how the code here changes in order to work with AS3, clearly it would involve listeners but sadly I'm completely at a loss as on how to use them.
Any help would be appreciated. Thanks in advance.
Is Flash Player 7 Causing Scroll Stick With Flash 5 Code?
HI all
I have a scroll menu I created in flash 5 which worked like a dream when viewed with flash player 6.
Unfortunately It looks like flash player 7 makes it stick really bad.
Has anybody else had that problem and resolved it?
Also can flash player 6 play mx 2004 code?
I have a menu in flash 5 code acessing mx2004 swf files and the menu keeps sticking but only since I updated my flash player to 7.
Please anyone can you tell me if this is a flash player issue? and if so can I use flash player 6 to play mx2004 stuff if its the cause of the stickyness?
thx
Shaf
Changing Code To Make Menu Vertically Scroll
Hi ok ive downloaded this menu from this site which is free to use and modify etc.
The problem is that there's a blue box that follows the cursor as it moves over one of the links (buttons) It's goes horzitionally across the screen, but i actually want it to be a vertical menu, so instead of moving across it does the same thing but downwards.
The code for the box that follows the cursor is;
onClipEvent (load) {
col = new Color(this);
var tx=this._x;
loc=tx;
}
onClipEvent (enterFrame) {
this._x += (loc-this._x)/4;
}
And the code that is an invisible box which i imagine is the parameters of where the box moves and how fast etc etc. That's
onClipEvent(load){
mpoint = new object();
}
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
mpoint.x = this._xmouse;
mpoint.y = this._ymouse;
localToGlobal(mpoint);
_parent.dragger.loc=mpoint.x;
} else {
}
}
Now i'm not good with code and don't have any clue what needs changing to make it go down instead of across.
Any help would be amazing.
Thanks a lot
Dave
[F8] Changing Rotating Images Code To Use An Keytroke Instead Of _xmouse
I am trying to change a script for rotating images to control it by the "left" and "right" keys of the keyboard. It now works (x) mouse position. moving mouse to left or right will change direction and speed.
The probleme is I seem to be unable to change the _xmouse into a variable that is give by the
on (keyPress "<Left>") {
_root.keyposX = 0;
}
I would really be great if someone was time help me on this.
gr diemster
---------------- org script ---------------
imagelist = ["images/01.jpg", "images/02.jpg", "images/03.jpg", "images/04.jpg", "images/05.jpg", "images/06.jpg", "images/07.jpg", "images/01.jpg"], "images/01.jpg", "images/01.jpg";
MovieClip.prototype.rotation_menu = function (imageList, posX, posY, alpha, focus, posZ, radius, loading, turnfactor)
{
var angle = 0;
var images = [];
var pi = 2 * Math.PI;
var image, dimension, piangle;
var xfactor = 300;
this._x = posX;
this._y = posY;
this._alpha = alpha;
for (var i = 0; i < imageList.length; i++)
{
image = this.attachMovie ("loadingclips", "image" + i, i);
image.wphase = pi / imageList.length * i;
image.container.loadMovie (imageList[i]);
if (loading == false) image.window._visible = 0;
images.push (image);
}
this.onEnterFrame = function ()
{
xfactor =_root.keyposX;
angle += center.[COLOR=Magenta]_xmouse[/color] / turnfactor;
if (angle >= pi) angle -= pi;
if (angle < 0) angle += pi;
for (var i = 0; i < images.length; i++)
{
image = images[i];
image.x = radius * Math.cos (image.wphase + angle);
image.z = radius * Math.sin (image.wphase + angle) + posZ;
dimension = focus / image.z;
piangle = Math.atan2 (image.x, image.z);
image._x = image.x * dimension;
image._xscale = -100 * dimension * Math.sin (image.wphase + angle + piangle);
image._yscale = 100 * dimension;
image.swapDepths (-(int (image.z)));
}
};
}
// imageList, posX, posY, alpha, focus, posZ, radius, loading, turnfactor
center.rotation_menu (imagelist, Stage.width/2, Stage.height/2, 100, 600, 600, 200, true, 8000);
Changing Brightness For My Color Picker (with Easy-to-run Code)
I have a color picker, and I need to be able to change the movieclips brightness. I don't know how, but here is an idea of what I'm going for - using the alpha property instead:
PHP Code:
function drawGradientBox(size:uint, col:Array, alph:Array, rat:Array, matRot:Number) {
var sp:Sprite = new Sprite();
var mat:Matrix = new Matrix();
var fill:String = GradientType.LINEAR;
mat.createGradientBox(size, size, matRot, 0, 0);
sp.graphics.beginGradientFill(fill, col, alph, rat, mat);
sp.graphics.drawRect(0, 0, size, size);
return sp;
}
function deg2rad(deg:Number):Number {
return deg * (Math.PI/180);
}
function onHover(evt:MouseEvent):void {
if (spectrum.hitTestPoint(mouseX, mouseY, true)) {
col = bmd.getPixel(spectrum.mouseX, spectrum.mouseY);
//code.text = prependZeros(col);
}
}
function onAlphaHover(evt:MouseEvent){
colorPicker.alpha = evt.localY/100;
}
function prependZeros(hex:uint):String {
var hexString = hex.toString(16).toUpperCase();
var cnt:int = 6 - hexString.length;
var zeros:String = "";
for (var i:int = 0; i < cnt; i++) {
zeros += "0";
}
return "#" + zeros + hexString;
}
var underlay:Sprite = new Sprite();
underlay.graphics.beginFill(0);
underlay.graphics.drawRect(0, 0, 100, 100);
underlay.x = underlay.y = 10;
//addChild(underlay);
var colorPicker:Sprite = new Sprite();
colorPicker.cacheAsBitmap = true;
var colors:Array = [0xFF0000, 0xFFFF00, 0x00FF00, 0x00FFFF, 0x0000FF, 0xFF00FF, 0xFF0000];
var alphas:Array = [1, 1, 1, 1, 1, 1, 1];
var ratios:Array = [0, 42, 84, 126, 168, 210, 255];
var spectrum:Sprite = drawGradientBox(100, colors, alphas, ratios, 0);
colorPicker.addChild(spectrum);
colors = [0x000000, 0x000000];
alphas = [1, 0];
ratios = [0, 255];
var overlay:Sprite = drawGradientBox(100, colors, alphas, ratios, deg2rad(-90));
colorPicker.addChild(overlay);
colorPicker.x = 10;
colorPicker.y = 10;
this.addChild(colorPicker);
var col:uint;
var bmd:BitmapData = new BitmapData(colorPicker.width, colorPicker.
height, false, 0xFFFFFFFF);
bmd.draw(colorPicker);
colorPicker.addEventListener(MouseEvent.MOUSE_MOVE, onHover, false, 0, true);
var darknessPicker:Sprite = new Sprite();
darknessPicker.cacheAsBitmap = true;
colors = [0x000000, 0xFFFFFF];
alphas = [1, 1];
ratios = [0, 255];
var spectrum2:Sprite = drawGradientBox(100, colors, alphas, ratios, deg2rad(-90));
darknessPicker.addChild(spectrum2);
darknessPicker.width = 10;
darknessPicker.y = 10;
darknessPicker.x = 120;
this.addChild(darknessPicker);
darknessPicker.addEventListener(MouseEvent.MOUSE_MOVE, onAlphaHover, false, 0, true);
Any idea how I can change brightness? I want to take this little color picker and hook it in to some javascript - I think it will run a lot smoother than the pure JS ones out there.
Flash 6 Platformer Code.... Making It Work In Flash 8
Ok, here is what it is like in flash 8:
http://img136.imageshack.us/my.php?image=10ig.swf
And here it is in Flash 6:
http://img136.imageshack.us/my.php?image=11qe.swf
They are both Actionscript 2.0
Up - Jump
Left - Left
Right - Right
Ctrl - Punch
As you can see, in flash 8 some of the script dosent work. How can I basically "Convert" this Flash 6 code to Flash 8? If you will need the .fla just ask .
Thatnks, an as you can see I am just testing this out.
Changing Movie Clip Color ..whats Wrong With This Code?
Hi
I'm getting the movie clip name from access database through ASP which is a string. I have one frame in
my movie. The command txtTest.text= this.path is dispalying the retriebed value from teh database. So
data coming into the flash movie is not a prolem. So why is the movie clip color not changing?
Can anyone help me regarding this?
Thanks in advance.
------------------
Action Script
-----------------
stop();
this.onEnterFrame=function() {
sendDir=new LoadVars();
getDir=new LoadVars();
getDir.onLoad=function(){
myColor = new Color(this.path);
myColor.setRGB(0x006666);
txtTest.text= this.path;
};
sendDir.sendAndLoad("http://test/testNew.asp",getDir);
}
Problems With Starting _y Position Of Ball Changing During Running Code
Ok I have really easy script that makes a ball bounce mimicking gravity :
code: var count = 0;
ymov = 0;
gravity = 2;
_root.onEnterFrame = function() {
ymov += gravity;
ball._y += ymov;
trace(ball._y);
if (ball._y>400) {
ball._y = 400;
ymov *= -1;
count++;
}
if (count==3) {
_root.onEnterFrame = null;
}
};
The reason I put the count variable in the code is that I wanted to see what the _y position of the ball was doing so ran it 3 times to get a read out from “trace” of the _y position, now here is the weird thing;
The ball that I positioned on the stage @ _y =70 gives an initial trace read out of 72 when the code first runs no problem there however, as the ball goes through it’s bounce when it comes back up again it will only go up to 94 & not 72 what’s happening there?
Sorry to post on such a pedantic point but this is really baffling me.
Changing Code To Load External Swfs Instead Of Html Links
Hi
So I've purchased a flash nav menu with some actionscript that's a lot more advanced than my skills. All I want to do is change the code so that i can make the buttons load external swfs instead of launching an html window. Any help would be really apreciated, I suspect it's some thing minor, but I can't figure it out. I've posted the script below, alot of it controls the look of the menu, I trimmed a bit off the end because the post was too long, I'm just concerned with the links part. Thanks in advance.
function subnum(i)
{
var inNum = 1;
var maxNum = 0;
while (inNum > maxNum)
{
if (this["sub" + i]["sub" + i + inNum] == undefined)
{
maxnum = inNum + 1;
continue;
} // end if
++inNum;
} // end while
max = 0;
return (inNum - 1);
} // End of the function
function onNout(n)
{
if (!n && _root.page)
{
n = _root.page;
benm = _root.page;
if (_root.page)
{
this["sub" + _root.page]["sub" + _root.page + _root.spage].frm(1);
} // end if
}
else
{
this["sub" + _root.page]["sub" + _root.page + _root.spage].frm();
} // end else if
for (i = 1; i <= num; i++)
{
if (n)
{
if (n == i)
{
this.ma.coloring(this.ma, i, 1);
this["mtxt" + i].alphaNfrmNmovXY(0, 1, undefined, undefined);
this["omtxt" + i].alphaNfrmNmovXY(100, undefined, undefined, undefined);
this.bar.subControler(_root["omtxt" + i]._x, _root["omtxt" + i]._width + 7, 100);
this["mline" + i].alphaNfrmNmovXY(0, 1, undefined, undefined);
this["mline" + (i - 1)].alphaNfrmNmovXY(0, 1, undefined, undefined);
this.bg._x = this["mtxt" + i]._x - 20;
this.bg._width = subw[i] + 20;
this["sub" + i]._y = 62;
this["sub" + i]._x = Math.round(subx[i]);
this["sub" + i]._alpha = 100;
this.bw.alphaNfrmNmovXY(100, 1, undefined, undefined);
}
else
{
this["mtxt" + i].alphaNfrmNmovXY(100, 1, undefined, undefined);
this["mline" + i].alphaNfrmNmovXY(100, 1, undefined, undefined);
this["omtxt" + i].alphaNfrmNmovXY(0, undefined, undefined, undefined);
this.bw.alphaNfrmNmovXY(0, 0, undefined, undefined);
this["sub" + i]._y = 400;
} // end else if
this.nbtn.frm(1);
continue;
} // end if
this.ma.coloring(this.ma, 0, 0);
this.bw.alphaNfrmNmovXY(100, 0, undefined, undefined);
this["mtxt" + i].alphaNfrmNmovXY(100, 0, undefined, undefined);
this["omtxt" + i].alphaNfrmNmovXY(0, undefined, undefined, undefined);
this["mline" + i].alphaNfrmNmovXY(100, 1, undefined, undefined);
this["sub" + i]._y = 400;
this.nbtn.frm(0);
} // end of for
} // End of the function
function init()
{
_global.num = 6;
_global.onum = 4;
_global.sub = new Array();
_global.subw = new Array();
_global.subx = new Array();
counter = 1;
for (i = 1; i <= num; i++)
{
this.nbtn.gotoAndStop(1);
this["mtxt" + i].gotoAndStop(1);
sub[i] = subnum(i);
subw[i] = this["sub" + i]._width;
subx[i] = this["sub" + i]._x;
this["sub" + i]._alpha = 0;
this.ma.gotoAndStop(1);
this["btn" + i].onRollOver = function ()
{
pagerControl(1);
nm = benm = this._name.substring(3, 4);
onNout(nm);
};
this["btn" + i].onRollOut = this["btn" + i].onReleaseOutside = function ()
{
pagerControl(2);
onNout();
nm = benm = this._name.substring(3, 4);
};
this["btn" + i].onRelease = function ()
{
name = this._name.substring(3, 4);
getURL(_root["connURL" + name + "0"], _root["connGET" + name + "0"]);
};
for (n = 1; n <= sub[i]; n++)
{
this["sub" + i]["sub" + i + n].gotoAndStop(1);
this["sub" + i]["sub" + i + n].onRollOver = function ()
{
pagerControl(1);
nm = benm = this._name.substring(3, 4);
onNout(nm);
this.frm(1);
};
this["sub" + i]["sub" + i + n].onRollOut = this["sub" + i]["sub" + i + n].onReleaseOutside = function ()
{
pagerControl(2);
onNout();
this.frm(0);
};
this["sub" + i]["sub" + i + n].onRelease = function ()
{
name = this._name.substring(3, 5);
getURL(_root["connURL" + name], _root["connGET" + name]);
};
} // end of for
} // end of for
this.bg.onRollOver = function ()
{
pagerControl(1);
nm = benm;
onNout(nm);
};
this.bg.onRollOut = this.bg.onReleaseOutside = function ()
{
pagerControl(2);
nm = benm = undefined;
onNout();
};
this.nbtn.onRelease = function ()
{
if (counter == 1)
{
this.frm(1);
nBtnControler(1);
this._parent.masd.Check = true;
++counter;
} // end if
};
this.nbtn.onRollOver = function ()
{
this.frm(1);
};
this.nbtn.onRollOut = function ()
{
this.frm(0);
};
this.bg.useHandCursor = false;
this.masd.inbt.onRollOver = function ()
{
};
this.masd.inbt.useHandCursor = false;
for (i = 1; i <= onum; i++)
{
this["obtn" + i].onRollOver = function ()
{
};
this["obtn" + i].onRollOut = this["obtn" + i].onReleaseOutside = function ()
{
};
this["obtn" + i].onRelease = function ()
{
name = this._name.substring(4, 5);
getURL(_root["oURL" + name], _root["oGET" + name]);
};
} // end of for
} // End of the function
function nBtnControler(st)
{
var i = 1;
while (i <= num)
{
if (st == 1)
{
onNout();
this["btn" + i]._visible = true;
this.bg._visible = true;
this.m_mask.xwidth(Stage.width);
this["obtn" + i]._alpha = 100;
this["oline" + i]._alpha = 100;
}
else if (_root.page != undefined || _root.spage != undefined)
{
onNout();
}
else
{
this.m_mask._width = 0;
this["mtxt" + i]._alpha = 0;
this["btn" + i]._visible = false;
this.bg._visible = false;
this.bar._alpha = 0;
this["mline" + i]._alpha = 0;
this["obtn" + i]._alpha = 0;
this["oline" + i]._alpha = 0;
} // end else if
++i;
} // end while
} // End of the function
function pagerControl(st)
{
if (st == 1)
{
_root.pager.gotoAndStop(1);
_root.page = "";
}
else if (st == 2)
{
_root.pager.play();
} // end else if
} // End of the function
Stage.align = "";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
_root.connURL10 = "125.html";//COMPANY
_root.connURL11 = "125.html";
_root.connURL12 = "125.html";
_root.connURL13 = "125.html";
_root.connURL14 = "125.html";
_root.connURL15 = "125.html";
_root.connURL16 = "125.html";
_root.connURL20 = "125.html";//BUSINESS
_root.connURL21 = "125.html";
_root.connURL22 = "125.html";
_root.connURL23 = "125.html";
_root.connURL24 = "125.html";
_root.connURL30 = "125.html";//PRODUCTS
_root.connURL31 = "125.html";
_root.connURL32 = "125.html";
_root.connURL33 = "125.html";
_root.connURL34 = "125.html";
_root.connURL35 = "125.html";
_root.connURL40 = "125.html";SERVICE
_root.connURL41 = "125.html";
_root.connURL42 = "125.html";
_root.connURL43 = "125.html";
_root.connURL44 = "125.html";
_root.connURL45 = "125.html";
_root.connURL50 = "125.html";SOLUTION
_root.connURL51 = "125.html";
_root.connURL52 = "125.html";
_root.connURL53 = "125.html";
_root.connURL54 = "125.html";
_root.connURL60 = "125.html";SUPPORT
_root.connURL61 = "125.html";
_root.connURL62 = "125.html";
_root.connURL63 = "125.html";
_root.connURL64 = "125.html";
_root.connURL65 = "125.html";
_root.connURL66 = "125.html";
_root.connGET10 = "";
_root.connGET11 = "";
_root.connGET12 = "";
_root.connGET13 = "";
_root.connGET14 = "";
_root.connGET15 = "";
_root.connGET16 = "";
_root.connGET20 = "";
_root.connGET21 = "";
_root.connGET22 = "";
_root.connGET23 = "";
_root.connGET24 = "";
_root.connGET30 = "";
_root.connGET31 = "";
_root.connGET32 = "";
_root.connGET33 = "";
_root.connGET34 = "";
_root.connGET35 = "";
_root.connGET40 = "";
_root.connGET41 = "";
_root.connGET42 = "";
_root.connGET43 = "";
_root.connGET44 = "";
_root.connGET45 = "";
_root.connGET50 = "";
_root.connGET51 = "";
_root.connGET52 = "";
_root.connGET53 = "";
_root.connGET54 = "";
_root.connGET60 = "";
_root.connGET61 = "";
_root.connGET62 = "";
_root.connGET63 = "";
_root.connGET64 = "";
_root.connGET65 = "";
_root.connGET66 = "";
_root.oURL1 = "125.html";//HOME
_root.oURL2 = "125.html";//LOGIN
_root.oURL3 = "125.html";//JOIN
_root.oURL4 = "125.html";//SITEMAP
_root.oGET1 = "";
_root.oGET2 = "";
_root.oGET3 = "";
_root.oGET4 = "";
MovieClip.prototype.xwidth = function (tw)
{
var speed = 2.000000E-001;
tw = tw == undefined ? (this._width) : (tw);
this.onEnterFrame = function ()
{
this._width = this._width + (tw - this._width) * speed;
if (Math.abs(tw - this._width) < 1)
{
delete this.onEnterFrame;
} // end if
};
};
MovieClip.prototype.coloring = function (name, n, pb)
{
chg = new Color(name);
var confirm = 0;
this.color0 = "255, 255, 255";
this.color1 = "167, 190, 0";
this.color2 = "0,169,190";
this.color3 = "146, 23, 237";
this.color4 = "255, 5, 81 ";
this.color5 = "255, 102, 0";
this.color6 = "227,0,16";
col = this["color" + n].split(",", 3);
cRed = col[0];
cGreen = col[1];
cBlue = col[2];
var spd = 4;
this.onEnterFrame = function ()
{
confirm = 0;
if (pb == 1)
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
++confirm;
} // end if
}
else
{
this.prevFrame();
if (this._currentframe == 1)
{
++confirm;
} // end if
} // end else if
with (name)
{
thisColor = chg.getTransform();
thisColor.rb = thisColor.rb + (cRed - thisColor.rb) / spd;
thisColor.gb = thisColor.gb + (cGreen - thisColor.gb) / spd;
thisColor.bb = thisColor.bb + (cBlue - thisColor.bb) / spd;
chg.setTransform(thisColor);
if (Math.abs(thisColor.rb - cRed) <= 8)
{
thisColor.rb = cRed;
thisColor.gb = cGreen;
thisColor.bb = cBlue;
chg.setTransform(thisColor);
++confirm;
} // end if
} // End of with
if (confirm == 3)
{
delete this.onEnterFrame;
} // end if
};
};
MovieClip.prototype.mcAlphaMove = function (txa, txb, tyc, tyd, al)
{
var speed = 2.000000E-001;
al = al == undefined ? (0) : (al);
txa = txa == undefined ? (this._x) : (txa);
txb = txb == undefined ? (this._y) : (txb);
tyc = tyc == undefined ? (this._x) : (tyc);
tyd = tyd == undefined ? (this._y) : (tyd);
al = al == undefined ? (this._alpha) : (al);
this.onEnterFrame = function ()
{
this._x = this._x + (txa - this._x) * speed;
this._y = this._y + (txb - this._y) * speed;
this._alpha = this._alpha + (al - this._alpha) * speed;
if (Math.abs(this._x - txa) < 1 && Math.abs(txb - this._y) < 1 && Math.abs(al - this._alpha) < 1)
{
this._x = tyc;
this._y = tyd;
delete this.onEnterFrame;
} // end if
};
};
MovieClip.prototype.frm = function (pb)
{
this.onEnterFrame = function ()
{
if (pb == 1)
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
delete this.onEnterFrame;
} // end if
}
else
{
this.prevFrame();
if (this._currentframe == 1)
{
delete this.onEnterFrame;
} // end if
} // end else if
};
};
MovieClip.prototype.alphaNfrmNmovXY = function (al, pb, x, y)
{
var spd = 4;
var confirm = 0;
al = al == undefined ? (0) : (al);
x = x == undefined ? (this._x) : (x);
y = y == undefined ? (this._y) : (y);
this.onEnterFrame = function ()
{
confirm = 0;
if (pb == 1)
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
++confirm;
} // end if
}
else
{
this.prevFrame();
if (this._currentframe == 1)
{
++confirm;
} // end if
} // end else if
this._alpha = this._alpha + (al - this._alpha) / spd;
if (Math.abs(this._alpha - al) < 4)
{
this._alpha = al;
++confirm;
} // end if
this._x = this._x + (x - this._x) / spd;
this._y = this._y + (y - this._y) / spd;
if (Math.abs(this._y - y) < 1 && Math.abs(this._x - x) < 1)
{
this._x = x;
this._y = y;
++confirm;
} // end if
if (confirm == 3)
{
delete this.onEnterFrame;
} // end if
};
};
Trace Shows Variables Changing So Why Doesn't My Code Work?
I have this code to swap buttons. 'current' holds the current pages while 'currenttab' holds the currently selected tab (button) corresponding to that page.
The page is set to solo when first run then clicking on the button evolution should target the movie instances held by current and current tab hiding them - then the idea is that the variables are updated to reflect the changes so when another button is pressed it will 'know' what page is current and target the correct movies..
what actually happens is that even though trace is showing that the variables are changing it keeps targetting the same movie as if the variables are the same..
the variables are being set on the frame above in the same timeline but i have tried making them global on the first frame of the main timeline but no change..
and also my if..then statement doesn't work - even when trace says that the value of current is 'evolution' is still keeps acting as if it isn't.
evobutton.onRelease = function() {
//checks if the current page is the same as the button clicked //
if(current != "evolution"){
// if it's not then move and fade out current page //
this._parent[current].gotoAndPlay(2);
this._parent[current].alpha(5, 0);
// puts away the page tab and fades it //
this._parent.titletabs[currenttab].gotoAndPlay(22);
this._parent.titletabs[currenttab].alpha(5, 70);
// fades up the new movie and moves new page tab//
evolution.alpha(5, 100);
titletabs.evotab.gotoAndPlay(2);
//sets the new variables //
var current = "evolution";
var currenttab = "evotab";
// //
trace(current);
trace(currenttab);
}
};
any help very much appreciated - in my fourth day of trying to fix this..
:thumb2:
[CS3] Flash 6 Code Incompatible With Flash 9 Player - Help?
Hi
I've been working on a photo gallery which can be seen at www.soloist.co.nz/gallery.
The ActionScript is below. It does pretty much exactly what I want it to when published in Flash Player 6, but reverts to standard startDrag behaviour (ie no inertia in the movement, and no snapping) when published for Flash Player 9.
I can't figure out what's wrong with the code - any help would be greatly appreciated.
import gs.TweenLite;
import gs.easing.*;
import mx.transitions.Tween;
var j:Number = -225; // half of the mc width
_root.photo_mc.onPress = function() {
this.drag = true;
this.startDrag (false, -4500, this._y, 4500, this._y);
this.xPos = this._x;
this.yPos = this._y;
this.onEnterFrame = function() {
if (this.drag) {
trace (this.xspeed);
this.xspeed = (this._x - this.xPos); // x mouse speed
this.yspeed = (this._y - this.yPos); // y mouse speed
this.xPos = this._x;
this.yPos = this._y;
} else {
this._x += this.xSpeed;
this._y += this.ySpeed;
this.xSpeed *= 0.8; // decrease x speed by 20%
this.ySpeed *= 0.8; // decrease y speed by 20%
if (Math.abs(this.xSpeed) < 0.1 && Math.abs(this.ySpeed) < 0.1) { // if almost no movement, end enterframe loop
stopped();
}
}
}
}
_root.photo_mc.onRelease = _root.photo_mc.onReleaseOutside = function () {
this.drag = false;
this.stopDrag();
}
function stopped() {
if((photo_mc._x > j) && (photo_mc._x < -j)){
TweenLite.to(photo_mc, 0.5, {_x:0, _y: 0, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 3*j) && (photo_mc._x < j)){
TweenLite.to(photo_mc, 0.5, {_x:2*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 5*j) && (photo_mc._x < 3*j)){
TweenLite.to(photo_mc, 0.5, {_x:4*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 7*j) && (photo_mc._x < 5*j)){
TweenLite.to(photo_mc, 0.5, {_x:6*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 9*j) && (photo_mc._x < 7*j)){
TweenLite.to(photo_mc, 0.5, {_x:8*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 11*j) && (photo_mc._x < 9*j)){
TweenLite.to(photo_mc, 0.5, {_x:10*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 13*j) && (photo_mc._x < 11*j)){
TweenLite.to(photo_mc, 0.5, {_x:12*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 15*j) && (photo_mc._x < 13*j)){
TweenLite.to(photo_mc, 0.5, {_x:14*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 17*j) && (photo_mc._x < 15*j)){
TweenLite.to(photo_mc, 0.5, {_x:16*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else if((photo_mc._x > 19*j) && (photo_mc._x < 17*j)){
TweenLite.to(photo_mc, 0.5, {_x:18*j, _y: this._y, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
else {
TweenLite.to(photo_mc, 0.5, {_x:0, _y: 0, ease:Strong.easeInOut, onComplete:delete _root.photo_mc.onEnterFrame});
}
}
Elasticity: Help With Converting Flash 5 Code To Flash 8
Hello
because I have to make a flash menu with elasticity effect I came upon this tutorial: http://www.kirupa.com/developer/actionscript/spring.htm
All OK but the code there works only with Flash 5. I somehow managed to concoct code that works for Flash 6 but still I didn't come even close to a code working in Flash 8. I'm using Actionscript only from version 7, I do not know anything about Flash 5 and 6. So please, the more experienced guys, help me!!
The code I concocted is:
MovieClip.prototype.move = function (centerx, centery, inertia, k) {
this.x = -this._x+centerx;
this.y = -this._y+centery;
this.xp = this.xp*inertia+this.x*k;
this.yp = this.yp*inertia+this.y*k;
this._x += this.xp;
this._y += this.yp;
};
onEnterFrame=function() {
this.move (_root._xmouse,_root._ymouse,0.9,0.1) ;
}
This whole code is on the timeline of the MC being moved.
So now the only thing I need is to make this code work for Flash 8
Please, help
Attach Code
MovieClip.prototype.move = function (centerx, centery, inertia, k) {
this.x = -this._x+centerx;
this.y = -this._y+centery;
this.xp = this.xp*inertia+this.x*k;
this.yp = this.yp*inertia+this.y*k;
this._x += this.xp;
this._y += this.yp;
};
onEnterFrame=function() {
this.move (_root._xmouse,_root._ymouse,0.9,0.1) ;
}
Edited: 06/26/2007 at 06:06:09 AM by _EnergiE_
HELP Trying To Make Flash 5 AS Code Work In Flash 8
hey guys,
I have a menu bar slider that was created in flash 5 - but of course once I bring into flash 8 the action script ceases to work correctly.
its probably very quick fix, but im a bit lost here, tried everything.
anyone able to quickly skim over my code and tell me whats wrong? and how to update it to flash 8?
heres the FLA
http://www.designedmemory.com/slide.fla
really have to figure this out ASAP -
best,
Matthew
Help Trying To Make Flash 5 Code Work In Flash 8
hey guys,
I have a menu bar slider that was created in flash 5 - but of course once I bring into flash 8 the action script ceases to work correctly.
its probably very quick fix, but im a bit lost here, tried everything.
anyone able to quickly skim over my code and tell me whats wrong? and how to update it to flash 8?
heres the FLA
http://www.designedmemory.com/slide.fla
really have to figure this out ASAP -
best,
Matthew
Convert ActionScript Code From Flash 5 To Flash 8
Greetings,
I have a Flash5 Actionscript here that does not work on Flash8, I´ve tryed to fix but had no sucess...
Can anyone help me with that ??
Code:
largodemo = 25;
myString = this._name;
temp1 = "";
for (n=0; n<largodemo; n++) {
temp1 += chr(random(42)+48);
}
temp2 = this.myString.substr(0, i);
this.eltexto = temp2+temp1.substring(i, largodemo);
i++;
if (i<=largodemo) {
gotoAndPlay(1);
} else {
stop();
}
|