Cleaner Code
Hi all, I'm currently working on creating a simulated training flash-based presentation and I'm looking to improve my coding habits. Part of the simulation was to create a custom cursor that functions just as any data entry cursor would. Here's where I need to improve: The user is restricted to only entering uppercase glyphs at this point, so the cursor should only respond if a letter character is pressed. All other characters should be ignored. I've figured a method to do this, and it works just fine, but the code is very repetitive and long. I'm guessing that there is a better way to do this by referencing a list of key codes in the conditional statement, but I'm not sure how to go about it. Here's what the code looks like Thanks
Code: onClipEvent(keyDown) { //ignore tab if (key.isDown(9)) { this._x = this._x; } else if (key.isDown(12)) { this._x = this._x; } else if (key.isDown(13)) { this._x = this._x; } else if (key.isDown(16)) { this._x = this._x; } else if (key.isDown(17)) { this._x = this._x; } else if (key.isDown(112)) { this._x = this._x; } else if (key.isDown(113)) { this._x = this._x; } else if (key.isDown(114)) { this._x = this._x; } else if (key.isDown(115)) { this._x = this._x; } else if (key.isDown(116)) { this._x = this._x; } else if (key.isDown(117)) { this._x = this._x; } else if (key.isDown(118)) { this._x = this._x; } else if (key.isDown(119)) { this._x = this._x; } else if (key.isDown(120)) { this._x = this._x; } else if (key.isDown(121)) { this._x = this._x; } else if (key.isDown(122)) { this._x = this._x; } else if (key.isDown(123)) { this._x = this._x; } else if (key.isDown(124)) { this._x = this._x; } else if (key.isDown(48)) { this._x = this._x; } else if (key.isDown(49)) { this._x = this._x; } else if (key.isDown(50)) { this._x = this._x; } else if (key.isDown(51)) { this._x = this._x; } else if (key.isDown(52)) { this._x = this._x; } else if (key.isDown(53)) { this._x = this._x; } else if (key.isDown(54)) { this._x = this._x; } else if (key.isDown(55)) { this._x = this._x; } else if (key.isDown(56)) { this._x = this._x; } else if (key.isDown(57)) { this._x = this._x; } else if (key.isDown(186)) { this._x = this._x; } else if (key.isDown(187)) { this._x = this._x; } else if (key.isDown(188)) { this._x = this._x; } else if (key.isDown(189)) { this._x = this._x; } else if (key.isDown(190)) { this._x = this._x; } else if (key.isDown(191)) { this._x = this._x; } else if (key.isDown(192)) { this._x = this._x; } else if (key.isDown(219)) { this._x = this._x; } else if (key.isDown(220)) { this._x = this._x; } else if (key.isDown(221)) { this._x = this._x; } else if (key.isDown(222)) { this._x = this._x; } else if (key.isDown(32)) { this._x = this._x; } else if (key.isDown(37)) { this._x = this._x; } else if (key.isDown(38)) { this._x = this._x; } else if (key.isDown(39)) { this._x = this._x; } else if (key.isDown(40)) { this._x = this._x; } else if (key.isDown(20)) { this._x = this._x; } else if (key.isDown(106)) { this._x = this._x; } else if (key.isDown(107)) { this._x = this._x; //don't move left of original position } else if (key.isDown(8)) { if (this._x > 104) { this._x -= 10; } //don't move right of new position } else if (this._x < 112) { this._x += 10; } }
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 05-12-2004, 02:32 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Cleaner Code
I have a code that consolidates current moneys into the least amount of tokens possible. It works but the actual code is extremely bulky, i was wondering if anyone has a tip or sees something that can be removed/replaced for less code
Thanks
code: C_Amount = _root.betTotal;
if(C_Amount < 25)
{
NumLeft = C_Amount % 10;
if(NumLeft < 5)
{
dollar_1 = NumLeft;
dollar_10 = (C_Amount - NumLeft) / 10;
}else{
NumLeft1 = NumLeft % 5;
dollar_1 = NumLeft1;
dollar_5 = (NumLeft - NumLeft1) / 5;
dollar_10 = (C_Amount - NumLeft) / 10;
}
}
[CS3] Cleaner Code
Hi,
Is there an easier, cleaner way to write:
type = _root.page;
if (_root.pageOn == 1)
{
if (type == 'ftp')
{
_root.content.ftp.filters = [myBlurFilter];
_root.content.ftp._alpha = 50;
}
if (type == 'news')
{
_root.content.news.filters = [myBlurFilter];
_root.content.news._alpha = 50;
}
if (type == 'hello')
{
_root.content.hello.filters = [myBlurFilter];
_root.content.hello._alpha = 50;
}
if (type == 'contact')
{
_root.content.contact.filters = [myBlurFilter];
_root.content.contact._alpha = 50;
}
if (type == 'exhibitions')
{
_root.content.exhibitions.filters = [myBlurFilter];
_root.content.exhibitions._alpha = 50;
}
if (type == 'interiors')
{
_root.content.interiors.filters = [myBlurFilter];
_root.content.interiors._alpha = 50;
}
if (type == 'conferences')
{
_root.content.conferences.filters = [myBlurFilter];
_root.content.conferences._alpha = 50;
}
if (type == 'live_events')
{
_root.content.live_events.filters = [myBlurFilter];
_root.content.live_events._alpha = 50;
}
if (type == 'new_media')
{
_root.content.new_media.filters = [myBlurFilter];
_root.content.new_media._alpha = 50;
}
if (type == 'people')
{
_root.content.people.filters = [myBlurFilter];
_root.content.people._alpha = 50;
}
if (type == 'clients')
{
_root.content.clients.filters = [myBlurFilter];
_root.content.clients._alpha = 50;
}
}
If/Else - Is There A Cleaner Code?
Hello all,
I am currently working on a flash file and I'm an intermediate user. My actionscript abilities are probably close to beginner, but I'm a quick learner (most of what I have learned with actionscript has been self taught).
In my flash file I have an animation of a rotating globe. Each frame of the rotation is a separate raster image - I don't know how you would represent a rotating globe otherwise, not really something that can be tweened (suggestions are welcome).
I have different locations off to the side of the globe. When the user mouses over a location, the globe spins to that location. When they roll out, the globe spins back to a static starting point.
I wanted the animation of the globe to be as smooth as possible, so, I have a }else{ statement for every possible frame. IE - if the globe animation is rotating back from a position and the user mouses over a new location before the animation stops, it doesn't jump back to the starting static position, it seemlessly flows from the position it is currently at to the new position the user has moused over.
Make sense?
It works flawlessly as is. I've spent quite a bit of time testing it. However, the code is bulky in appearance and according to the size report bulky in bytes as well.
Is there a differnent way to set this up to cut down on size - mainly byte size if possible?
I will include a bit of code so you can see what I'm talking about:
on (rollOver) {
if (_root.EarthClip._currentframe == 1) {
_root.EarthClip.gotoAndPlay(140);
} else { if (_root.EarthClip._currentframe == 160) {
_root.EarthClip.gotoAndPlay(156);
} else { if (_root.EarthClip._currentframe == 161) {
_root.EarthClip.gotoAndPlay(155);
} else { if (_root.EarthClip._currentframe == 161) {
_root.EarthClip.gotoAndPlay(154);
} else { if (_root.EarthClip._currentframe == 163) {
_root.EarthClip.gotoAndPlay(153);
and so on, and so on . . .
Any help would be greatly appreciated.
Thank you in advance.
-MShetler
Quick Question For Cleaner Code
Just need some advice on how to clean this code up. I know there has got to be a way to combine the 2 movieclips....
Basically I have 4 movieClip buttons. currently only the first is working.... How would I add the other f2, f3, f4 MC's without having to write a function for each one?
Here is the code I have:
Code:
f1.addEventListener(MouseEvent.MOUSE_OVER, hoverOver);
f1.addEventListener(MouseEvent.MOUSE_OUT, hoverOut);
f2.addEventListener(MouseEvent.MOUSE_OVER, hoverOver);
f2.addEventListener(MouseEvent.MOUSE_OUT, hoverOut);
f3.addEventListener(MouseEvent.MOUSE_OVER, hoverOver);
f3.addEventListener(MouseEvent.MOUSE_OUT, hoverOut);
f4.addEventListener(MouseEvent.MOUSE_OVER, hoverOver);
f4.addEventListener(MouseEvent.MOUSE_OUT, hoverOut);
function hoverOver(event:MouseEvent):void
{
f1.gotoAndPlay(2);
}
function hoverOut(event:MouseEvent):void
{
f1.gotoAndStop(11);
}
f1.buttonMode = true;
f2.buttonMode = true;
f3.buttonMode = true;
f4.buttonMode = true;
Cleaner
Hi
Just wondering if anyone uses Cleaner EZ which comes with Premier etc to compress their video files into Quicktime?
Im stuck on selecting the right settings...I need the video to be fairly small but it ALWAYS ends up being too blurred...
Thanks!
Can This Be Cleaner?
this is a movieclip that can move threw a maze of objects. if the user hits an object the movieclip jumps to frame that shows it crashing. Everything works. my question is.. can the code be cleaner or wrapped up in a function?
onClipEvent (enterFrame) {
if (Key.isDown(37)&& hitTest(_level0.wall)==false) {
_x=_x-4;
}
if (Key.isDown(38)&& hitTest(_level0.wall)==false) {
_y=_y-4;
}
if (Key.isDown(39)&& hitTest(_level0.wall)==false) {
_x=_x+4;
}
if (Key.isDown(40)&& hitTest(_level0.wall)==false) {
_y=_y+4;
}
if (hitTest(_level0.wall)==true) {
this.gotoAndPlay("hit");
}
if (hitTest(_level0.wall2)==true) {
this.gotoAndPlay("hit");
}
if (hitTest(_level0.wall3)==true) {
this.gotoAndPlay("hit");
}
}
[F8] Is There A Cleaner Way To Do This?
This code works just fine for restricting the area I can draw in, but it seems very inefficient. Is there a better way?
Code:
onMouseMove = function () {
if (_xmouse>32 && _ymouse>32 && _xmouse<607 && _ymouse<397) {
drawingArea.lineTo(_xmouse, _ymouse);
}
};
My movie actually uses close to 100% CPU after scribbling a lot, and I think it might be this code thats doing it.
AS2 - URL Cleaner
Hello, this is a great tool that i use to filter path to test locally.
the function:
function cleanVBLE(vble)
{
a = new String(vble);
b = a.split("/");
return b.pop();
}
the usage:
trace(cleanVBLE("/formas/80094/canalune.swf"));
Cleaner Animation
I am trying to make a movie which will play fullscreen with a small area with 20% opacity visible in the center. Now my character (any image) will erase the black background so that a clear picture becomes visible.
Pls. help. urgent
Cleaner Scripting
I think the code says it all. For a current project I need to use a hit area to start an animation when a mouse rolls over a _mc.
If I use the movie clip instead of a button I can simplify the script by using the first section of the attached code. In the simplified code I only have to define one over and one out state and then I can use a this statement to control the action.
For any number of _mc's I just need one set of functions.
Using buttons, each _mc needs it's own over and out definition and it's own unique set of functions.
I've tried using a bunch of if (grnMC_button.onRollOver = true) {this statements apply only to grn_mc} (not really code) but I can't find anything that works. It would be a great time saver if I could because in the final project I've got about 75 movie clips to control with over functions.
One more thing. I can't use the movie based code because the animations move out from under the buttons and the mouse over area gets big and overlaps the other "buttons". I guess I'm really looking for a way to define a hit area and still keep the code simple.
Attach Code
Movie driven _mc sample code:
˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
// over-out definitions
grn_mc.onRollOver = over;
grn_mc.onRollOut = out;
blu_mc.onRollOver = over;
blu_mc.onRollOut = out;
red_mc.onRollOver = over;
red_mc.onRollOut = out;
// onRollOver functions
function over () {
this.overThis = true;
this.gotoAndPlay("start");
}
// onRollOut functions
function out () {
this.overThis = false;
Button driven _mc sample code:
˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
// button definitions
grn_btn.onRollOver = over_grn;
grn_btn.onRollOut = out_grn;
blu_btn.onRollOver = over_blu;
blu_btn.onRollOut = out_blu;
red_btn.onRollOver = over_red;
red_btn.onRollOut = out_red;
// onRollOver functions
function over_grn () {
grn_mc.overThis = true;
grn_mc.gotoAndPlay("start");
}
function over_blu () {
blu_mc.overThis = true;
blu_mc.gotoAndPlay("start");
}
function over_red () {
red_mc.overThis = true;
red_mc.gotoAndPlay("start");
}
// onRollOut functions
function out_grn () {
grn_mc.overThis = false;
}
function out_blu () {
blu_mc.overThis = false;
}
function out_red () {
red_mc.overThis = false;
}
Edited: 05/16/2007 at 11:25:53 AM by Rick Gerard
Cleaner, Crisper Text
can anyone explain how to get cleaner, crisper text in FlashMX. Thank you.
LoriSchlitz
Cleaner 6 Or Sorenson Squeeze?
hi
I have cleaner 6, but a friend says sorenson squeeze it a better compressor for use of video in flash. Shoul i get a copy? or will cleaner suffice??
Techniques To A Cleaner Program
Hi, Im not an expert in flash, but I do on occasion help some buddies out if they want a menu or something on their webpage. When I am making these files, it seems like my organization and technique is sloppy. Any comments / suggestions / flames are welcome on how I could better organize this and other projects in the future.
~Thanks
Link to File:
http://www.geocities.com/matteoelbow/SR_Menu1.fla
Link to movie:
http://www.geocities.com/matteoelbow/SR_Menu1.swf
[CS3] Help Need A Cleaner Way To Write This Array Of Buttons
Hi there,
not sure how difficult this is going to be, but I have 30 movie clips, which will all be sequentially numbered. (pos1, pos2, pos3......pos30).
They will all have the same functions, with the only change being the number.
I know there is a more efficient way to write this code using arrays, but I will need help with it. I would rather have 10 lines of code than 150.
I also need help with writing the code, that will disable all other movie clips, once the first one is clicked.
Also, not sure how tricky the javascript part will be.
Below is the code i am trying to achieve, but the long version.
PHP Code:
pos1.onRelease=function(){
this.gotoAndStop("selected");
getURL("Javascript:JSposition('',1)");
(all other buttons).enabled = false;
}
pos2.onRelease=function(){
this.gotoAndStop("selected");
getURL("Javascript:JSposition('',2)");
(all other buttons).enabled = false;
}
pos3.onRelease=function(){
this.gotoAndStop("selected");
getURL("Javascript:JSposition('',3)");
(all other buttons).enabled = false;
}
pos4.onRelease=function(){
this.gotoAndStop("selected");
getURL("Javascript:JSposition('',4)");
(all other buttons).enabled = false;
}
... all the way to
pos30.onRelease=function(){
this.gotoAndStop("selected");
getURL("Javascript:JSposition('',30)");
(all other buttons).enabled = false;
}
AS Guru's please help!!!
Thanks.
Cleaner Movie Clip Dragging
I briefly remember seeing a tutorial for this somewhere but I cant find it anywhere. But is there a way to drag movie clips around using startDrag but with a cleaner more fluent motion as it a bit jolty when moving?
Anydony know the answer?
Flash Media Cleaner Addons
I'm looking for an add-on lilke Sorenson Squeeze for Flash, but this is a little pricey for me.
http://www.sorensonstore.com/product.../sq4mfwin.html
Does anyone know of something comparable for less? I know. You get what you pay for, but I need something to get me by while I'm learning Flash.
I'm not looking for shareware, etc. Just an inexpensive, nifty program to get me started as a newbie.
Thanks in advance for any help.
Can I just say I'm loving Flash. I just starting using it a few days ago, and I'm hooked! This is so much nicer when embedding video to webpages. Whoa!
Edit:
Does anyone know if the addon comes with Studio MX 2004? Because I plan on upgrading very soon. I definately don't want to dish out $119.00 for the addon if it ships with Macro's latest studio.
Scripting Is Supposed Flash Movie Much Cleaner
Scripting is supposed flash movie much cleaner, there should be a straight forward way to do this.
the example we can call "test.swf"
the movie clip we will call "fade" which resides inside the library
"fade" extends over 50 frames the first 30 have a snazzy animation upon a mouse click on a button in the main menu.
I would like to use this movie clip again just starting at frame 30. My question is can you reference a frame label inside the "fade" clip from the "test.swf?"
Note tell target is usefull by adding a ../ script you can exit a movie clip. Can you preform this code to enter in a clip?
Much thanks
aspiring asssstronaught
Problematic Flash Files: "Cleaner" Needed (Paid)
Hello all,
I've hit a wall in several small Flash movies that are integrated into one online course, things that I'm sure I can figure out with time, but time is something I ain't got. I need a Flash wiz who can figure out what I've done wrong, improve the actionscripting where necessary, and also finish off some elements that have me stumped (and tell me what I've done wrong in the process). It's actually pretty basic stuff...and all the major groundwork has been done...but there might be a few challenges. You need to be familiar with video/audio integration...everything else is standard stuff.
If you're interested, please send me an e-mail and let me know your preferred method of payment: hourly or project-basis...and if you prefer hourly, please let me know your hourly rate since I have to get approval. Also, please include a link to your Flash portfolio.
BTW - This could possibly lead to a long-term project-basis work relationship.
Thanks! I hope to hear from you!
John
[F8] Loading And Unloading External SWF Code Issues, Code Check Please
Okay, I'm still clumsy with AS and I'm having problems loading and unloading external SWFs. I have SWFs created by others in Captivate that need to be controlled by a main menu. I created the menu and buttons and have been trying to code it so that with the button click, the appropriate external SWF loads in an empty movie clip, plays, and then closes at the final frame and returns to the menu. So far, I can get it to load, but then I'm stuck as I'm not sure what I'm missing as far as it reading the frame numbers.
Here's the code I've written. I can't seem to get my idea for the onEnterFrame function checking the frames to work.
What am I missing? Can anyone offer any suggestions or guidance? Thanks!
Code:
this.createEmptyMovieClip("clip1", 1);
myfirst_btn.onRelease = function() {
clip1.loadMovie("externalswf1.swf");
}
mysecond_btn.onRelease = function() {
clip1.loadMovie("externalswf2.swf");
}
mythird_btn.onRelease = function() {
clip1.loadMovie("externalswf3.swf");
}
clip1.onEnterFrame = function() {
if (clip1._currentframe == clip1._totalframes) {
// remove move clip1 and return to menu
clip1.removeMovieClip();
}
}
External SWFs, Code Works But Not With Additional Code
I'm using a loadMovie code that works perfect by itself, but when I add additional code to the button, it doesn't work.
Here's the scenario:
I have an MC named songs In this MC I have several buttons that should each perform very similar actions.
The first action is a:
gotoAndPlay("somewhere"); action that takes the movie to a specific frame of this MC. This code by itself works fine.
The second action I need to happen is:
this.contents.loadMovie("music1.swf") which loads an external SWF which is nothing more than an MC with an audio clip. This code, by itself works fine.
The problem comes when I combine the two codes to create:
on (release)
{
gotoAndPlay("somewhere");
this.contents.loadMovie("music1.swf");
}
The movie does go to the "somewhere" frame, but the external SWF no longer loads.
I have tried it with _root.songs.contents.loadMovie("music1.swf");
I have tried placing the loadMovie code first, but neither of those solutions work.
Any ideas?
Thanks
Help> How To Remove Part Of The Code Without Breaking The Entire Code
I use the following code on my website (http://www.misenplace.com.br ), it`s a fading out script that shows a banner underneath it.
I want to remove the pagetitle, welcome, date and sitename, but I can`t figure it out since when I remove something the movie doesn`t load or it doesn`t fade out as it was supposed to.
here`s the code
Quote:
var imgLoader = new MovieClipLoader();
var mindepth = welcome_txt.getDepth();
mindepth = mindepth < pagetitle_txt.getDepth() ? (mindepth) : (pagetitle_txt.getDepth());
mindepth = mindepth < date_txt.getDepth() ? (mindepth) : (date_txt.getDepth());
mindepth = mindepth < sitename_txt.getDepth() ? (mindepth) : (sitename_txt.getDepth());
var maxdepth = welcome_txt.getDepth();
maxdepth = maxdepth > pagetitle_txt.getDepth() ? (maxdepth) : (pagetitle_txt.getDepth());
maxdepth = maxdepth > date_txt.getDepth() ? (maxdepth) : (date_txt.getDepth());
maxdepth = maxdepth > sitename_txt.getDepth() ? (maxdepth) : (sitename_txt.getDepth());
this.createEmptyMovieClip("imageHolder_mc", mindepth - 1);
imageHolder_mc._x = 0;
imageHolder_mc._y = 0;
imageHolder_mc._alpha = 0;
imageHolder_mc.duplicateMovieClip("imageMasker_mc" , maxdepth + 1);
imageMasker_mc._alpha = 0;
imgLoader.loadClip(imageName, imageHolder_mc);
imgLoader.loadClip(imageName, imageMasker_mc);
welcome_txt.text = themessage;
welcome_txt._visible = false;
welcome_txt.autoSize = true;
var sitename_str = pagetitle;
var pagetitle_str = "";
var pos = sitename_str.indexOf(" - ");
if (pos > 0)
{
pagetitle_str = sitename_str.substr(pos + 3);
sitename_str = sitename_str.substr(0, pos);
} // end if
pagetitle_txt.text = pagetitle_str;
pagetitle_txt._visible = false;
pagetitle_txt.autoSize = true;
sitename_txt.text = sitename_str;
sitename_txt._visible = false;
sitename_txt.autoSize = true;
var curdate = new Date();
var date_str = curdate.toString();
var pos = date_str.indexOf(":");
var datestr = date_str.substr(0, pos - 3);
datestr = datestr + (", " + date_str.substr(date_str.length - 4));
date_txt.text = datestr;
date_txt._visible = false;
date_txt.autoSize = true;
imgLoader.onLoadComplete = function (targetMC)
{
_root.onEnterFrame = function ()
{
if (imageHolder_mc._alpha < 100)
{
imageHolder_mc._alpha = imageHolder_mc._alpha + 3;
}
else
{
if (!welcome_txt._visible)
{
welcome_txt._visible = true;
pagetitle_txt._visible = true;
sitename_txt._visible = true;
date_txt._visible = true;
imageMasker_mc._alpha = 100;
} // end if
imageMasker_mc._alpha = imageMasker_mc._alpha - 3;
if (imageMasker_mc._alpha <= 0)
{
delete _root["onEnterFrame"];
} // end if
} // end if
};
};
thanks a lot everyone
Movieclip Code Interacting With Document Class Code
I'm coding an application in Flash CS3 but relying heavily on doing most of the heavy lifting in actionscript3. I've set a document class (i.e. package me.mine{ class Main extends Sprite(){} }) with most of the code necessary.
In my Library I've got a Movie Clip for a control panel. I instantiate the movie clip from the Main class. This movie clip will change itself around (an off state and an on state with different menu options) - and i want to be able to add a button within the clip, and when it's clicked, have it call out to a function in the the Main class.
But I can't figure out how to get the MovieClip to talk to the Main class (I can set event listeners from the Main class on elements in the clip, but the clip will change around so I want it to work in the other direction).
Thanks for your help!
Code - What Code? You Didn't Spend Hours Writing It.
Hello,
Has anyone had a problem where sometimes (for no apparent reason) flash doesn't retain your code after you save and quit and then reopen the fla?
I used to think this was happening due to my backup app., but it's not running anymore. I even saved an additional copy of the file on my desktop AND dragged another copy to another folder. Everything was missing the same code.
We I published the swf before exiting, it worked perfectly.
Any ideas for fixes? Running os 10.3. Tried getting rid of prefs - no luck.
This is getting annoying. Happens with every fla I'm editing.
Thanks,
Ward
Newbie Convert Button Code To Frame Code
Hi all!
I guess this is a really simple one.
I have a button with the following code attached to it:
PHP Code:
this.onRelease = function() { SWFAddress.setValue('/portfolio/');}this.onRollOver = function() { SWFAddress.setStatus('/portfolio/');}this.onRollOut = function() { SWFAddress.resetStatus();}
I want to use this code on a frame. Is it onLoad I need to use??
Object/embed Code Missing From Source Code
I have the wackiest problem.. its killing me. I developed a simple flash banner for a client. It works fine on 99% of all machines, but the client's machine happens to be in the 1% that it DOES NOT work on. When he pulls up the page containing the flash file, he gets nothing. He has the latest flash plugin, and can view other flash content. When I view the source code on the machine that is having the problem, all the code is there EXCEPT the object/embed code. Its just missing. What in the world could cause that? I checked for firewall issues. He is running norton firewall. I disabled it, but he still has the problem.
This is the page in question:
http://projects.newtarget.net/RELOconnections/flashtest.html
as you can see, nothing special. simple flash, simple code. the other computers in his office have no trouble, its just his computer and his parents computers. I tried the page in IE 6 and firefox. Same result, he is not getting the flash code. He's on WinXP.
Can anybody think of ANY reason why he would be being shielded from getting object/embed flash code?
-vb
My Code Has No Friends: The Story Of My Sucky Code
I have an text input. I want it so that when you hit enter, it'll do stuff.
I want one of the commands to be...
goto
...however, here's the issue:
onClipEvent (enterFrame) {
pressed = Key.getCode();
pinputinn = pinput.toLowerCase();
if ((pinputinn == "goto") and (pressed == 13)) {
gotoAndStop (2);
}
}
Could someone tell me why that doesn't work, and what would work?
[Edited by Crickett on 07-20-2001 at 11:17 PM]
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???????
[F8] Help. Integrate Cpu Check Code With Preloader Code
Hi, guys!
I was looking for a way to do a cpu check over the user´s computer and then, based on the user´s cpu speed, redirect his browser towards one of two different versions of the same flash movie (let´s say, a "light" one without effects and a "full" one with all the effects). I´ve already got a fine working preloader, and I´ve found a nice cpu check code here in this forum. The problem now is that I am not able to put them together. Something like, after a mouseclick, perform the cpu check and after that load a movie based on the previous cpu check...
I am posting my fla and the original cpu check fla that I´ve found here to show what I´ve got so far.
Thanks in advance!
[F8] Sound Code Does Not Work Unless It Is The Last Line Of Code?
Hi.
My code _root.sndBeep.start(); will not play a sound no matter where in my onEnterFrame function I put it, unless it is the last line of code in that function.
Anyone know how that is possible?
Example code:
PHP Code:
onEnterFrame = function(){ // Tons of code above this point not worth posting. _root.sndBeep.start(); // This sound will never play WHY?? if (Hearts < 3 && Hearts != 0) { if (!bLowHealthPlaying) { _root.sndLowHealth.start(0,99999); bLowHealthPlaying = true; } } else { _root.sndLowHealth.stop(); bLowHealthPlaying = false; } _root.sndBeep.start(); // Yet the sound works perfectly fine here??}
I Need Some Basic Help Getting My Pseudo Code Into Working Code
id appreciate a hand from you guys, if you could.
ive got a fla (575x431) that im making for an image gallery.... i will have 20 images that will be icons probably 40-50% smaller than the full size image these will be movie clips that i will assign a very slow random movement to
i think that i have the random part ok, i just need some help with this part...
pardon me if my terminology isnt right..
If mouse (over) a mc, then;
stop mc, show mc label, title.
If mc is clicked, then;
enlarge scale of mc (ie, 100%) and center it on the stage.
If mouse (out) then;
return mc size to its former state and continue moving randomly.
hope this makes sense would really appreciate some direction....
thanks alot
løk
Javascript Code To Actionscript Code?
I have some actionscript code that makes a really cool clock effect. I was wondering if anyone knew how to convert the javascript code to actionscript or if it is even possible to do. If not, does anyone know how to recreate the effect in flash/actionscript? You can view the actual javascript effect by going to www.uncontrol.com and clicking on the clock file. The javascript code is as follows:
Thanks for any help...
-- K
__________________________________________________ ______
// clock
// created using proce55ing application | www.proce55ing.net
// copyright© www.uncontrol.com | mannytan@uncontrol.com
// ************************************************** **********************
// initialize
// ************************************************** **********************
boolean mouseStatus = false;
boolean priorMouseStatus = false;
int x, y, z;
int i, j, k;
float counter=1;
String time,s_hour,s_min, s_sec;
float pos_x, pos_y;
float radius;
float SECOND_INC = .0166;// 1/60
float MINUTE_INC = .0166;// 1/60
float HOUR_INC = .0833;// 1/12
float current_sec, current_min, current_hr;
float radian_percentage;
// ************************************************** **********************
// set up
// ************************************************** **********************
void setup() {
size(400, 400);
background(255);
hint(SMOOTH_IMAGES);
BFont ocr;
ocr = loadFont("OCR-B.vlw.gz");
setFont(ocr, 16);
ellipseMode(CENTER_DIAMETER);
rectMode(CENTER_DIAMETER);
}
// ************************************************** **********************
// listeners
// ************************************************** **********************
void mousePressed() {
mouseStatus = true;
}
void mouseReleased() {
mouseStatus = false;
}
void loop() {
translate(width/2, height/2);
radian_percentage = ((mouseY+.0001)*.0025);
rotateX(TWO_PI * radian_percentage * -1);
// --------------------------------------------
// analog marks numbers
// --------------------------------------------
push();
rotateX(TWO_PI*(.25));
for (i=1;i<=12;i++) {
push();
if (i==12) {
noStroke();
fill(255,102,0);
} else {
noStroke();
fill(0,0,0,75);
}
rotateZ(TWO_PI*((i)*HOUR_INC));
if (i<10) {/* ads a zero*/
text("0"+i, -5, -145);
} else {
text(""+i, -5, -145);
}
//rect(0,145,4,10);
pop();
}
pop();
// --------------------------------------------
// digital marks colon symbols
// --------------------------------------------
push();
translate(cos(2*TWO_PI*radian_percentage)*7+7,0);
rotateX(TWO_PI*(radian_percentage));
text(":", 0, 0);
pop();
push();
translate(cos(2*TWO_PI*radian_percentage)*-7+2,0);
rotateX(TWO_PI*(radian_percentage));
text(":", 0, 0);
pop();
push();
// --------------------------------------------
// second
// --------------------------------------------
current_sec = second();
radius = 120;
translate(cos(2*TWO_PI*radian_percentage)*10+10,0) ;
rotateY(TWO_PI*(((45)+current_sec)*SECOND_INC)*-1);
// draw shaded circle
noStroke();
// draw numbers
for (i=0; i<=59;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+current_sec)*SECOND_INC)*-1);
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+current_sec)*SECOND_INC));
rotateY(TWO_PI*(((45)+current_sec)*SECOND_INC));
rotateX(TWO_PI*(radian_percentage));
if (i==current_sec) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}
if (i<10) {/* ads a zero*/
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}
pop();
// --------------------------------------------
// minute
// --------------------------------------------
current_min = minute() + (second()*SECOND_INC);
radius = 100;
push();
translate(0,0);
rotateY(TWO_PI*(((45)+current_min)*MINUTE_INC)*-1);
// draw shaded circle
noStroke();
// draw numbers
for (i=0; i<=59;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+int(current_min))*MINUTE_INC)*-1);
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+int(current_min))*MINUTE_INC));
rotateY(TWO_PI*(((45)+current_min)*MINUTE_INC));
rotateX(TWO_PI*(radian_percentage));
if (i==int(current_min)) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}
if (i<10) {/* ads a zero*/
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}
pop();
// --------------------------------------------
// hour
// --------------------------------------------
current_hr = hour()%12 + (minute()*MINUTE_INC);
radius = 40;
push();
translate(cos(2*TWO_PI*radian_percentage)*-10-10,0);
rotateY(TWO_PI*(((9)+current_hr)*HOUR_INC)*-1);
// draw shaded circle
noStroke();
// draw numbers
for (i=0; i<=11;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((6-i)+int(current_hr))*HOUR_INC)*-1);
translate(radius,0);
rotateZ(TWO_PI*(((6-i)+int(current_hr))*HOUR_INC));
rotateY(TWO_PI*(((9)+current_hr)*HOUR_INC));
rotateX(TWO_PI*(radian_percentage));
if (i==int(current_hr)) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}
if (i==0) {/* ads a zero*/
text("12", 0, 0);
} else if (i<10) {
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}
pop();
// ************************************************** **********************
// mouse press initializer
// ************************************************** **********************
if (mouseStatus == true && priorMouseStatus == false) {
priorMouseStatus = true;
// ************************************************** **********************
// mouse press looper
// ************************************************** **********************
} else if (mouseStatus == true && priorMouseStatus == true) {
priorMouseStatus = true;
// ************************************************** **********************
// mouse release initializer
// ************************************************** **********************
} else if (mouseStatus == false && priorMouseStatus == true) {
priorMouseStatus = false;
// ************************************************** **********************
// mouse release looper
// ************************************************** **********************
} else if (mouseStatus == false && priorMouseStatus == false) {
priorMouseStatus = false;
}
}
Adding Code To Existing Code
I've been after an answer for this problem for some time!
I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!
I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.
How would this be possible? Can I add some coding to the existing code thats placed on the movie?
PLEASE PLEASE HELP IF YOU CAN!
Adding Code To Existing Code
I've been after an answer for this problem for some time!
I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!
I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.
How would this be possible? Can I add some coding to the existing code thats placed on the movie?
PLEASE PLEASE HELP IF YOU CAN!
Adding Code To Existing Code
I've been after an answer for this problem for some time!
I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!
I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.
How would this be possible? Can I add some coding to the existing code thats placed on the movie?
PLEASE PLEASE HELP IF YOU CAN!
[AS3] Run Code End Of Movie W/o Timeline Code?
Super noob question on AS3. I'm told that I'm to avoid putting any code in the timeline and use classes instead. I have a simple logo running in the beginning it has no timeline code. How do I make it so that it will call a function when the movieclip is finished playing?
Thanks!
How To Convert Java Code To As3 Code
package ConvertNumberIntoWords;
class EnglishDecimalFormat {
private static final String[] majorNames = {
"",
" thousand",
" million",
" billion",
" trillion",
" quadrillion",
" quintillion"
};
private static final String[] tensNames = {
"",
" ten",
" twenty",
" thirty",
" fourty",
" fifty",
" sixty",
" seventy",
" eighty",
" ninety"
};
private static final String[] numNames = {
"",
" one",
" two",
" three",
" four",
" five",
" six",
" seven",
" eight",
" nine",
" ten",
" eleven",
" twelve",
" thirteen",
" fourteen",
" fifteen",
" sixteen",
" seventeen",
" eighteen",
" nineteen"
};
private String convertLessThanOneThousand(int number) {
String soFar;
if (number % 100 < 20){
soFar = numNames[number % 100];
number /= 100;
}
else {
soFar = numNames[number % 10];
number /= 10;
soFar = tensNames[number % 10] + soFar;
number /= 10;
}
if (number == 0) return soFar;
return numNames[number] + " hundred" + soFar;
}
public String convert(int number) {
/* special case */
if (number == 0) { return "zero"; }
String prefix = "";
if (number < 0) {
number = -number;
prefix = "negative";
}
String soFar = "";
int place = 0;
do {
int n = number % 1000;
if (n != 0){
String s = convertLessThanOneThousand(n);
soFar = s + majorNames[place] + soFar;
}
place++;
number /= 1000;
} while (number > 0);
return (prefix + soFar).trim();
}
public static void main(String[] args) {
EnglishDecimalFormat f = new EnglishDecimalFormat();
System.out.println("*** " + f.convert(0));
System.out.println("*** " + f.convert(17708));
System.out.println("*** " + f.convert(16));
System.out.println("*** " + f.convert(100));
System.out.println("*** " + f.convert(118));
System.out.println("*** " + f.convert(200));
System.out.println("*** " + f.convert(219));
System.out.println("*** " + f.convert(800));
System.out.println("*** " + f.convert(801));
System.out.println("*** " + f.convert(1316));
System.out.println("*** " + f.convert(1000000));
System.out.println("*** " + f.convert(2000000));
System.out.println("*** " + f.convert(3000200));
System.out.println("*** " + f.convert(700000));
System.out.println("*** " + f.convert(5960809));
System.out.println("*** " + f.convert(123456789));
System.out.println("*** " + f.convert(-45));
System.out.println("*** " + f.convert(99565789));
// (99565789)
/*
*** zero
*** seventeen thousand seven hundred eight
*** sixteen
*** one hundred
*** one hundred eighteen
*** two hundred
*** two hundred nineteen
*** eight hundred
*** eight hundred one
*** one thousand three hundred sixteen
*** one million
*** two million
*** three million two hundred
*** seven hundred thousand
*** five million nine hundred sixty thousand eight hundred nine
*** one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine
*** negative fourty five
*** ninety nine million five hundred sixty five thousand seven hundred eighty nine
*/
}
}
Where Should I Place The Preloader Code In This Code..
hi Users,
I am working on a Flash Project in which I have to display a Calendar highlights the dates which have events. Now before loading the Calendar I am calling all the info from a PHP file and then storing it in an array and the using the info for highlighting the days of the events. Now as the info is getting big and big the Calendar is taking sometime to load. I want to place a preloader so that it shows that the Calendar is getting the info. The problem is that I dunno where to place the preloader code. Here is my code where I am getting the info from PHP files:
ActionScript Code:
tellTarget (_root) {
cal.stop();
eventDates = new LoadVars();
eventDates.load("getEvents.php");
eventDates.onData = function(values) {
if (values == undefined) {
eventDates.load("getEvents.php");
} else {
checkPlay();
_root.eventsCollection = new Array();
_root.eventsCollection = values.split("~");
}
};
//
recursiveEvents = new LoadVars();
recursiveEvents.load("getEvents1.php");
recursiveEvents.onData = function(values) {
if (values == undefined) {
recursiveEvents.load("getEvents1.php");
} else {
checkPlay();
_root.recEventsCollection = new Array();
_root.recEventsCollection = values.split("~");
}
};
}
i = 0;
function checkPlay() {
i++;
if (i == 2) {
play();
}
}
Now I would like to know where should I put the preloader code. Need help. The above code is in a MovieClip which is placed on the main stage.
Regards,
Xeeschan
Help Please With Code Animated Rollover Code
I am trying to make a tutorial i got from http://www.were-here.com/content/tem...d=679&zoneid=7 work and i have done everything but the code didn't work. I have rewrote it and it also doesn't work. Could someone please take a look at it or tell me where I can go to get a better tutorial that does the same thing.
on (rollOver)
if (_currentframe=1)
gotoAndPlay(2);
else if (_currentframe=20)
stop
else
gotoAndPlay (39-_currentframe)
end if}
end on
on (rollOut)
if (_currentframe=20)
gotoAndPlay (21)
else
gotoAndPlay (39-_currentframe)
end if
end on
Code To Long Any Other Way To Write This Code
i've been reading / learning actionscript 3 and i am making some simple practice .. but its too long any other way i can write this code it works fine but its too long.. thanks
Code:
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.net.*;
import flash.events.Event;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
public class Test extends Sprite
{
//private
private var navStyle:StyleSheet;
//NAV CONTAINER
private var navContainer:Sprite;
//HOME
private var home:Sprite;
private var homeText:TextField;
//COMPANY
private var company:Sprite;
private var companyText:TextField;
//SERVICES
private var services:Sprite;
private var servicesText:TextField;
//CONTACT
private var contact:Sprite;
private var contactText:TextField;
public function Test() {
init();
}
public function init():void {
loadStyleSheet();
initStage();
}
private function loadStyleSheet():void
{
var styleLoader:URLLoader = new URLLoader();
styleLoader.addEventListener(Event.COMPLETE , completeListener);
styleLoader.load(new URLRequest("css/test.css"));
}
private function completeListener (e:Event):void {
var navStyle:StyleSheet = new StyleSheet();
navStyle.parseCSS(e.target.data);
navContainer = new Sprite();
// HOME
home = new Sprite();
homeText = new TextField();
homeText.selectable = false;
homeText.antiAliasType = AntiAliasType.ADVANCED;
homeText.autoSize = TextFieldAutoSize.LEFT;
homeText.styleSheet = navStyle;
homeText.htmlText="<p class='navigation'><b>HOME</b></p>";
home.addChild(homeText);
addChild(home);
// COMPANY
company = new Sprite();
companyText = new TextField();
companyText.selectable = false;
companyText.antiAliasType = AntiAliasType.ADVANCED;
companyText.autoSize = TextFieldAutoSize.LEFT;
companyText.styleSheet = navStyle;
companyText.htmlText="<p class='navigation'><b>COMPANY</b></p>";
company.addChild(companyText);
addChild(company);
// SERVICES
services = new Sprite();
servicesText = new TextField();
servicesText.selectable = false;
servicesText.antiAliasType = AntiAliasType.ADVANCED;
servicesText.autoSize = TextFieldAutoSize.LEFT;
servicesText.styleSheet = navStyle;
servicesText.htmlText="<p class='navigation'><b>SERVICES</b></p>";
services.addChild(servicesText);
addChild(services);
// CONTACT
contact = new Sprite();
contactText = new TextField();
contactText.selectable = false;
contactText.antiAliasType = AntiAliasType.ADVANCED;
contactText.autoSize = TextFieldAutoSize.LEFT;
contactText.styleSheet = navStyle;
contactText.htmlText="<p class='navigation'><b>CONTACT</b></p>";
contact.addChild(contactText);
addChild(contact);
home.x = 0;
company.x = home.width + 20;
services.x = company.x + company.width + 20;
contact.x = services.x + services.width + 20;
navContainer.addChild(home);
navContainer.addChild(company);
navContainer.addChild(services);
navContainer.addChild(contact);
addChild(navContainer);
}
private function textFormat (navText:TextField, menuLabel:String):void {
navText = new TextField();
navText.selectable = false;
navText.embedFonts = true;
navText.antiAliasType =AntiAliasType.ADVANCED;
navText.type = TextFieldType.DYNAMIC;
navText.autoSize = TextFieldAutoSize.LEFT;
navText.styleSheet = navStyle;
navText.htmlText ="<p class='navigation'><b> "+menuLabel+" </b></p>";
}
private function initStage():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
}
}
}
Help Me With This Code(small Code) Mx
I need help with this script.
I dont find the way to make it display the correct month.
I know that flash does count from 0 to 11 for the months but i cant find out how to make it display 10 for october.
calendarday = today.getDate() + "/"+ today.getMonth() + "/" + today.getFullYear();
Btw is someone knows how to make the real day names and months show up instaed of the numbers it would be nice if you give me a hand on it
Thanks a lot
Code W/in Code Problem
hello, all, have an AS question:
i have a movie clip that, upon rollover, plays the movie clip. upon rollout, the movie clip plays in reverse. now, the last frame in this movie clip has two additional movie clips, so if you can envision:
test
|
|
|
-----> test_02
|
|
-----> test_03
both test_02 and _03 have animation, such that, upon rollover, the movie clip plays and upon rollout, the movie clip plays in reverse. the code for all three are, in fact, the same.
i have tested the code, and all of them work just fine. however, when i place test_02 and test_03 in the test movie clip, their animation (rollover, rollout) does not work.
here is the code on the movie clip (it is the same code for test, test_02, and test_03, but the variable names are just different)
on(rollOver){
_root.over_test = true;
}
on(rollOut){
_root.over_test = false;
}
here is the code on the actions layer:
n_test.onEnterFrame = function(){
if(_root.over_test){
this.nextFrame();
}else{
this.prevFrame();
}
}
any help is greatly appreciated.
Capturing Key Code. Which Code Is Better
Hi!
I want to check whethe user has pressed the TAB key or not.I can write the code in two ways.I want to know which one is better?
1)on Movieclip
onClipEvent (keyDown) {
kp = Key.getCode();
if (kp == 9) {
trace("tab is pressed");
}
}
2)on Button
on(keyPress "<Tab>"){
trace("tab is pressed");
}
Which method is better. Is there any advantages/drawbacks of using above code?
Thank You.
Mahesh K.
Do I Need To Use Less Code Or Can I Delete This Code?
I am using the code below on each MC (16 in all) so that each MC will appear in the swf at 90% of original size. These will be used for thumbnails for larger pics in the site.
My 2 part question is this - (1) is there a different way to do the same effect that uses less code? (2) if I uses the code the way it is, is there a way to delete the code once the thumbnails have all appeared on the stage?
code:
onClipEvent( EnterFrame ){
var speed = 10
var viscosity = 1.3
xscale = 75
yscale =75
difference = xscale - this._xscale
xvelocity = (xvelocity + difference / speed) / viscosity
this._xscale = this._xscale + xvelocity
difference = yscale - this._yscale
xvelocity = (xvelocity + difference / speed) / viscosity
this._yscale = this._yscale + xvelocity
}
Convert AS1 Code To AS3 Code
Hi All;
I have a lot of code in AS1 and which I have to vonvert to AS3.There are 4000 files so it is difficult to write all the code from scratch.
So, can anybody suggest me the esiest way to convert these code from AS1 to AS3.
Please Help Me..............
Thanks in Advance.........
Can AS1 Code Call AS3 Code?
I was wondering if there was any way for AS1 code to call AS3 code.
I need to write a server extension for SmartFox Pro. I just found out that the only version of action script that SmartFox sever extensions can be written in is AS1. However, I have a bunch of code already written in AS3 that I need to use. I have all of the source for the AS3 code.
Is there a way for me to use my existing code, or am I out of luck?
Thanks in advance
John Lawrie
AS3 - Regexp For [code] ... [/code]
Hi all!
How would one write an regexp that detects the occurances of [c0de] ... [/c0de] in a textstring? for example:
Lorem ipsum [c0de]dolor sit amet, consectetur adipiscing elit.[/c0de] Curabitur pulvinar nisl eget turpis. Aenean nulla. Integer bibendum sapien sit amet lorem. Integer vulputate enim ut diam. Fusce non sapien. Vivamus venenatis. [c0de]Nulla facilisi.[/c0de] Mauris tincidunt turpis at lorem. Nulla tellus. Suspendisse vitae nisl ac diam consectetur tempus.
|