Easy (I Think) MC Communication (looks Long But It's All Just Explanatory Code) =)
I am moving/scaling a MC called "menu" using this actionscript that is attatched to it:
onClipEvent (load) { _root.targY = 190; } onClipEvent (enterFrame) { cY = this._y; difY = cY-_root.targY; setProperty(this, _y, cY-(difY/5)); } onClipEvent (load) { _root.targX = 265; } onClipEvent (enterFrame) { cX = this._x; difX = cX-_root.targX; setProperty(this, _x, cX-(difX/5)); } onClipEvent (load) { _root.scaleX = 100; } onClipEvent (enterFrame) { sX = this._xscale; difS = sX-_root.scaleX; setProperty(this, _xscale, sX-(difS/5)); } onClipEvent (load) { _root.scaleY = 100; } onClipEvent (enterFrame) { sY = this._yscale; difSY = sY-_root.scaleY; setProperty(this, _yscale, sY-(difSY/5)); }
The the user clicks a button with this script and the "menu" MC moves/scales:
on (release) { _root.targY = 475; } on (release) { _root.targX = 575; } on (release) { _root.scaleX = 220; } on (release) { _root.scaleY = 220; }
When the "menu" MC reaches the coordinates that the above button sent it to, I want a button to then appear, giving the user the option to go "back". I have tried to get a "button" MC with "onClipEvent (enterFrame)" to check and see if _y=475 and if it is then have the "button" MC play to a certain frame and therefore reveal the back button. For some reason it doesn't work...maybe one of you gurus have a easier way of doing this?????????
FlashKit > Flash Help > Flash MX
Posted on: 03-11-2003, 11:09 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Should Be An Easy One... Remote File Communication
Hi everyone,
I am pretty basic when it comes to actionscripting and programming so I hope this makes sense.....
When a user clicks a flash 'home' button from within the site I want them to go to the last frame of the index page swf file..rather than have watch it get built again....
This is the site:http://www.maasaieducation.org
I did run a search of the forums - but I don't even know what terminolgy I am looking for!
Many thanks,
M
btw - MX2004
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;
}
}
}
[AS]mc Code Is Too Long
Last edited by rjm : 2005-07-16 at 09:36.
Im working on setting up a photogallery for personal use. Ive figured out how to move the photos from one location to another. The problem is its takes a whole lot of code just for one photo. What I want to do is minimize the amount of code needed for each photo to go from point a to point b. Im sure theres someway to make a function that each photo could call to simplify things, But I really dont have the knowledge to do so.
If anyone could please check out the FLA file and let me know what I would have to do to simplify things that would be great!
-thanx in advance.
Photogallery.fla
Long Code Shortened
Hi,
How can I express this in a short form like a Math method, NO array please.
(myvar+1)+(myvar+2)+(myvar+3)+(my............
A Long Piece Of Code With A Problem.. Help PLEASE
ok.. here's the situation: m tryin to make a man jump with this code. the man should keep jumping as long as i keep the spacebar pressed. but the problem is, for the first jump, the MC skips frame no. 2 to 6 and hence the jump is shortened.
the jmp MC contains animation for the actions while jumping. the actual up and down movement is generated in the code below. this code is written in the frame of the root movie. the root movie has several layers but is only one frame long.
below the code i have pasted the trace results. please please help me out. i'm stumped.
myListener.onKeyDown = function ()
{
if(Key.isDown(Key.SPACE))
{
trace("space "+jumping); //jumping is an int variable. indicates whether the man is already in air jumping(1) or not(0).
if(jumping==0)
{
trace("jumping is 0");
_root.sm._visible = false; //a MC showing standing man. irrelevant.
_root.runner._visible = false; //a MC showing running man. irrelevant.
_root.attachMovie("pjump","jmp",200);
jmp._x = manposx;
jmp._y = _root.surface._y - _root.surface._height/2 - _root.manheight - 20;
jumping = 1;
jmp.play();
trace("1.frame: "+jmp._currentframe);
}
trace("2.frame: "+jmp._currentframe);
if(jmp._currentframe>2 && jmp._currentframe<8)
{
trace(jmp._y + " frame " + jmp._currentframe);
jmp._y-=20;
trace("after "+jmp._y);
}
trace("3.frame: "+jmp._currentframe);
if(jmp._currentframe>=8)
{
jmp._y+=15;
}
trace("4.frame: "+jmp._currentframe+ " stpscl "+stopscroll);
border = jmp._y + jmp._height/2
if( border > ( surface._y - (surface._height/2) + 40) )
{
jumping = 0;
}
trace("5.frame: "+jmp._currentframe);
if(_root.opponent._x - jmp._x <700)// irrelevant
_root.attack = 1;
trace("6.frame: "+jmp._currentframe);
}
}
surface is the ground on which he stands. stuff marked irrelevant is of course, irrelevant to this problem..
the jmp movie is 10 frames long.
here's the outcome:
space 0 //ROUND ONE
jumping is 0
1.frame: 1
2.frame: 1
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 6 //THERE YOU GO..
265.4 frame 6
after 245.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
245.4 frame 7
after 225.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
225.4 frame 7
after 205.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
205.4 frame 7
after 185.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.05 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
1.frame: 1 //ROUND TWO
2.frame: 1 //EVERYTHING IS SMOOTH FROM HEREON..
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 3
265.4 frame 3
after 245.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
245.4 frame 3
after 225.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
225.4 frame 3
after 205.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 4
205.4 frame 4
after 185.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
185.4 frame 4
after 165.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
165.4 frame 4
after 145.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 5
145.4 frame 5
after 125.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 5
125.4 frame 5
after 105.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 6
105.4 frame 6
after 85.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
85.4 frame 6
after 65.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
65.4 frame 6
after 45.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
45.4 frame 7
after 25.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
25.4 frame 7
after 5.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
5.4 frame 7
after -14.6
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.925 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
and so on.. please help me..
A Long Piece Of Code With A Problem..
ok.. here's the situation: m tryin to make a man jump with this code. the man should keep jumping as long as i keep the spacebar pressed. but the problem is, for the first jump, the MC skips frame no. 2 to 6 and hence the jump is shortened.
the jmp MC contains animation for the actions while jumping. the actual up and down movement is generated in the code below. this code is written in the frame of the root movie. the root movie has several layers but is only one frame long.
below the code i have pasted the trace results. please please help me out. i'm stumped.
myListener.onKeyDown = function ()
{
if(Key.isDown(Key.SPACE))
{
trace("space "+jumping); //jumping is an int variable. indicates whether the man is already in air jumping(1) or not(0).
if(jumping==0)
{
trace("jumping is 0");
_root.sm._visible = false; //a MC showing standing man. irrelevant.
_root.runner._visible = false; //a MC showing running man. irrelevant.
_root.attachMovie("pjump","jmp",200);
jmp._x = manposx;
jmp._y = _root.surface._y - _root.surface._height/2 - _root.manheight - 20;
jumping = 1;
jmp.play();
trace("1.frame: "+jmp._currentframe);
}
trace("2.frame: "+jmp._currentframe);
if(jmp._currentframe>2 && jmp._currentframe<8)
{
trace(jmp._y + " frame " + jmp._currentframe);
jmp._y-=20;
trace("after "+jmp._y);
}
trace("3.frame: "+jmp._currentframe);
if(jmp._currentframe>=8)
{
jmp._y+=15;
}
trace("4.frame: "+jmp._currentframe+ " stpscl "+stopscroll);
border = jmp._y + jmp._height/2
if( border > ( surface._y - (surface._height/2) + 40) )
{
jumping = 0;
}
trace("5.frame: "+jmp._currentframe);
if(_root.opponent._x - jmp._x <700)// irrelevant
_root.attack = 1;
trace("6.frame: "+jmp._currentframe);
}
}
surface is the ground on which he stands. stuff marked irrelevant is of course, irrelevant to this problem..
the jmp movie is 10 frames long.
here's the outcome:
space 0 //ROUND ONE
jumping is 0
1.frame: 1
2.frame: 1
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 6 //THERE YOU GO..
265.4 frame 6
after 245.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
245.4 frame 7
after 225.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
225.4 frame 7
after 205.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
205.4 frame 7
after 185.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.05 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
1.frame: 1 //ROUND TWO
2.frame: 1 //EVERYTHING IS SMOOTH FROM HEREON..
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 3
265.4 frame 3
after 245.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
245.4 frame 3
after 225.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
225.4 frame 3
after 205.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 4
205.4 frame 4
after 185.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
185.4 frame 4
after 165.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
165.4 frame 4
after 145.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 5
145.4 frame 5
after 125.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 5
125.4 frame 5
after 105.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 6
105.4 frame 6
after 85.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
85.4 frame 6
after 65.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
65.4 frame 6
after 45.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
45.4 frame 7
after 25.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
25.4 frame 7
after 5.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
5.4 frame 7
after -14.6
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.925 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
and so on.. please help me..
My Code Is Extremely Convoluted And Long.. Could I Get Help?
Hi forum,
I have a product showcase movie I'm creating (everyday). My problem is the way I write my code. I have found that it is quickest for me to write code in the timeline for stuff like this. I am hoping that somebody could assist me by downloading my FLA file, checking out my method of writing code and give me some tips on how I could write it in a more condensed way.. and also where it would work right! (I believe there is a timer coordination problem at the moment)
What the movie does is actually pretty simple, use a timer to advance through three different product lines for an online store. Also have three buttons that could perform the same advancement that the timer does. I am using Tweener for animations and I find that very quickly my code gets huge and unwieldy.
The catch with this movie is I want the button not to just immediately jump to the next product but to end the animation of the current product BEFORE jumping to the next product animation. That's where I'm getting caught.
Thank you for your help!
Here's the movie in it's current state: http://www.giantcomet.com/Brian/BigFly.html
And the FLA: http://www.giantcomet.com/Brian/BigFly.fla
A Long Piece Of Code With A Problem.. Help PLEASE
ok.. here's the situation: m tryin to make a man jump with this code. the man should keep jumping as long as i keep the spacebar pressed. but the problem is, for the first jump, the MC skips frame no. 2 to 6 and hence the jump is shortened.
the jmp MC contains animation for the actions while jumping. the actual up and down movement is generated in the code below. this code is written in the frame of the root movie. the root movie has several layers but is only one frame long.
below the code i have pasted the trace results. please please help me out. i'm stumped.
myListener.onKeyDown = function ()
{
if(Key.isDown(Key.SPACE))
{
trace("space "+jumping); //jumping is an int variable. indicates whether the man is already in air jumping(1) or not(0).
if(jumping==0)
{
trace("jumping is 0");
_root.sm._visible = false; //a MC showing standing man. irrelevant.
_root.runner._visible = false; //a MC showing running man. irrelevant.
_root.attachMovie("pjump","jmp",200);
jmp._x = manposx;
jmp._y = _root.surface._y - _root.surface._height/2 - _root.manheight - 20;
jumping = 1;
jmp.play();
trace("1.frame: "+jmp._currentframe);
}
trace("2.frame: "+jmp._currentframe);
if(jmp._currentframe>2 && jmp._currentframe<8)
{
trace(jmp._y + " frame " + jmp._currentframe);
jmp._y-=20;
trace("after "+jmp._y);
}
trace("3.frame: "+jmp._currentframe);
if(jmp._currentframe>=8)
{
jmp._y+=15;
}
trace("4.frame: "+jmp._currentframe+ " stpscl "+stopscroll);
border = jmp._y + jmp._height/2
if( border > ( surface._y - (surface._height/2) + 40) )
{
jumping = 0;
}
trace("5.frame: "+jmp._currentframe);
if(_root.opponent._x - jmp._x <700)// irrelevant
_root.attack = 1;
trace("6.frame: "+jmp._currentframe);
}
}
surface is the ground on which he stands. stuff marked irrelevant is of course, irrelevant to this problem..
the jmp movie is 10 frames long.
here's the outcome:
space 0 //ROUND ONE
jumping is 0
1.frame: 1
2.frame: 1
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 6 //THERE YOU GO..
265.4 frame 6
after 245.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
245.4 frame 7
after 225.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
225.4 frame 7
after 205.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
205.4 frame 7
after 185.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.05 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
1.frame: 1 //ROUND TWO
2.frame: 1 //EVERYTHING IS SMOOTH FROM HEREON..
3.frame: 1
4.frame: 1
5.frame: 1
6.frame: 1
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 2
3.frame: 2
4.frame: 2
5.frame: 2
6.frame: 2
space 1
2.frame: 3
265.4 frame 3
after 245.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
245.4 frame 3
after 225.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 3
225.4 frame 3
after 205.4
3.frame: 3
4.frame: 3
5.frame: 3
6.frame: 3
space 1
2.frame: 4
205.4 frame 4
after 185.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
185.4 frame 4
after 165.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 4
165.4 frame 4
after 145.4
3.frame: 4
4.frame: 4
5.frame: 4
6.frame: 4
space 1
2.frame: 5
145.4 frame 5
after 125.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 5
125.4 frame 5
after 105.4
3.frame: 5
4.frame: 5
5.frame: 5
6.frame: 5
space 1
2.frame: 6
105.4 frame 6
after 85.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
85.4 frame 6
after 65.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 6
65.4 frame 6
after 45.4
3.frame: 6
4.frame: 6
5.frame: 6
6.frame: 6
space 1
2.frame: 7
45.4 frame 7
after 25.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
25.4 frame 7
after 5.4
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 7
5.4 frame 7
after -14.6
3.frame: 7
4.frame: 7
5.frame: 7
6.frame: 7
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 8
3.frame: 8
4.frame: 8
5.frame: 8
6.frame: 8
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 9
3.frame: 9
4.frame: 9
5.frame: 9
6.frame: 9
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
5.frame: 10
6.frame: 10
space 1
2.frame: 10
3.frame: 10
4.frame: 10
379.925 surface 376.9
5.frame: 10
6.frame: 10
space 0
jumping is 0
and so on.. please help me..
Flash Communication With C++ Code
Is there anyway to make action script communicate with dlls? I will elaborate on the scenario. I have a flash application running inside XUL framework and the flash application communicates with javascript using ExternalInterface methods. Now javascript uses XPCOM to communicate with the dlls, instead of this can we have a method to make the communication direct between the flash plug in and the dlls.
Long Lines Of Code... How Can I Drop Down A Line?
total noob question here and I'm surprised this is the first time I've encountered this but...
I have a very long line of script that I'm having to scroll far to the right in the Actions panel to modify. What's the trick for keeping the code constant but dropping it down a line for easier access?
thanks!
SWF Works Slowly When Long EnterFrame Code
When I have a long code in a enterframe() action or when I have a background animation my swf works slowly (depends on the computer I run it). I saw on web movies wich doesen't work slowly on low memory computers even if they have background animation!
How can I solve this problem?
How To Break A Long Line Of Code Across Multiple Lines
(sorry this is such a stupid question but...)
I hate having a loooooooong line of code that i have to scroll left and right on so I like to break them to make the code more readable...
in asp I would do
variable = "this string is so long" & _
" that I broke it across" & _
" three lines
what is the actionscript way?
Source Code And Examples From Programming Flash Communication Server
someone has tried to install examples applications :
SimplePeopleList
PeopleList
PeopleGrid
you introduce in the book: Programming Flash Communication Server
I don't succeed in making to work, perhaps not correct my configuration file
(I am in attended that my book arrives)
Probably Easy If Your A Code Wiz
Hi im creating a menu system by duplicating a movie called 'menu_item' it then generates 6 items namley 'menu_item1' ,2 ,3 etc
when you roll over a menu_item the txt for that button appears.
Now aswell as having rollover events for each of the 6 menu items, i'll also need onClicks onRollouts etc which is a hell of a lot code.
Is there a way of incorperating all of the onRollovers in one small statement .... thinking something like this
_root["menu_item"+i].onRollOver = function() {
menu_item1.menu_txt.text = "i m a g e s"
menu_item2.menu_txt.text = "i n f o"
menu_item3.menu_txt.text = "a b o u t"
menu_item4.menu_txt.text = "c u r r i c u l u m v i t a"
menu_item5.menu_txt.text = "o t h e r"
menu_item6.menu_txt.text = "s e r v i c e s"
}
}
do this make sense or am i talking out of my out hole
cheers
Help On This Easy Code?
Hey... I have made 4 movieclips, and I have 4 buttons. When I press a button I want a speciel movieclip to be visible and all the other ones invisible. That works, but only the first time. When I press e.g. the "billeder_btn" second time, the only thing that happens is, that the visible MC dissapears as it should.... but the billeder_mc does not become visible..... How can it be?
Here's the code:
billeder_btn.onRelease = function() {
billederMC_mc._visible = true;
billederMC_mc.gotoAndPlay(1);
musikMC_mc._visible = false;
anmeldelserMC_mc._visible = false;
infoMC_mc._visible = false;
}
musik_btn.onRelease = function() {
musikMC_mc._visible = true;
musikMC_mc.gotoAndPlay(1);
billederMC_mc._visible = false;
anmeldelserMC_mc._visible = false;
infoMC_mc._visible = false;
}
anmeldelser_btn.onRelease = function() {
anmeldelserMC_mc._visible = true;
anmeldelserMC_mc.gotoAndPlay(1);
billederMC_mc._visible = false;
musikMC_mc._visible = false;
infoMC_mc._visible = false;
}
info_btn.onRelease = function() {
infoMC_mc._visible = true;
infoMC_mc.gotoAndPlay(1);
billederMC_mc._visible = false;
musikMC_mc._visible = false;
anmeldelserMC_mc._visible = false;
}
what is wrong?
thanks alot...
__________________
--- Ronze ---
Why Won't This Code Work For Me - Easy
I'm re-doing an effect similar to this but for some reason it won't work. (I'm using the same code) I've searched all through the file but can't seem to find anything I've missed. Do the comments have anything to do with it?http://www.flashkit.com/movies/Interfaces/Menus/Simple_M-Marcel_v-1621/index.shtml
I understand the code, so I don't see why it won't work (the rollover/rollout do not work)
EASY ONE Colour Through Code
Hi there,
Is there a way to set an RGB color like in the Tint effect but via code?
I’ve used this:
_root.mymovie.setRGB(0x666666);
but doesn’t work at all...
My movieclip contains several other MCs and I’d like to set a color filter to all of them without having to specify each single item. Is that possible?
This must be easy, but I can’t find the option to use in the ActionScript Reference or Dictionary.
Thanks.
EASY Way To Protect Your CODE From Others
My friend and her twin sister, made up "OP language" as kids to speak in code.
{I feel like Nel}
basically place an "op" after each consanant and leave vowels alone:
my name, "Geordie" would be:
gopeoropdopie
gop
e
o
rop
dop
i
e
This presents a good way to fix code so it becomes unreadable to CodeJerkies. this op language is virually unreadable, annoying, easy to pickup, and totally changes the coding atmosphere so any thieves have to pull their hair out to understand the code:
Before OP language
Code:
function pageBack () {
if (modIncrement <= 1) {
if (htmlPage == 1) {
trace (course[modIncrement][htmlPage]);
thePageGet = course[modIncrement][htmlPage];
} else if (htmlPage > 1) {
htmlPage--;
thePageGet = course[modIncrement][htmlPage];
}
} else if (modIncrement > 1) {
if (htmlPage == 1) {
modIncrement--;
htmlPage = course[modIncrement].length - 1;
thePageGet = course[modIncrement][htmlPage];
} else if (htmlPage > 1) {
htmlPage--;
thePageGet = course[modIncrement][htmlPage];
}
}
newPage = (((("../" + courseID) + "/module") + modIncrement) + "/") + thePageGet;
getURL (newPage, "think-content");
_root.backLightUp.play();
seeDimension();
}
The Same Code in with OP-Language Applied:
Code:
function pageBack () {
if (mopodopInopcopropemopenoptop <= 1) {
if (hoptopmoplopPopagope == 1) {
trace (copouropsope[mopodopInopcopropemopenoptop][hoptopmoplopPopagope]);
tophopePopagopeGopetop = copouropsope[mopodopInopcopropemopenoptop][hoptopmoplopPopagope];
} else if (hoptopmoplopPopagope > 1) {
hoptopmoplopPopagope--;
tophopePopagopeGopetop = copouropsope[mopodopInopcopropemopenoptop][hoptopmoplopPopagope];
}
} else if (mopodopInopcopropemopenoptop > 1) {
if (hoptopmoplopPopagope == 1) {
mopodopInopcopropemopenoptop--;
hoptopmoplopPopagope = copouropsope[mopodopInopcopropemopenoptop].length - 1;
tophopePopagopeGopetop = copouropsope[mopodopInopcopropemopenoptop][hoptopmoplopPopagope];
} else if (hoptopmoplopPopagope > 1) {
hoptopmoplopPopagope--;
tophopePopagopeGopetop = copouropsope[mopodopInopcopropemopenoptop][hoptopmoplopPopagope];
}
}
nopewopPopagope = (((("../" + copouropsopeIDop) + "/module") + mopodopInopcopropemopenoptop) + "/") + tophopePopagopeGopetop;
getURL (nopewopPopagope, "think-content");
_root.backLightUp.play();
seeDimension();
}
All you really have to do after that is rename any textVariable fields according to OP-language rules. or you can make up your own language Fu<KeRupper so people can't steal your code.
I just thought this would be an easy one and it makes the code unbearable to look at and it's simple
Easy Way To Code This Navigation?
Hi, I am very impressed by the simple and stylish site navigation used on www.imagedive.com I mean the navigation menu in the bottom left corner.
I want to have the same navigation on my site but havent a clue on how to accomplish this. Looked everywhere for a similar code example that I could learn from, but found nothing.
Any help would be appreciated. Thanks
Importing This Code(Should Be Easy)
I have this code (HTML) for my website. This code makes a flash .swf play on my site.
--------------------------------------------------
<object>
<param name=movie value="http://music.myspace.com/index.cfm?fuseaction=music.player&xmlfid=5493280&s iteurl=http://music.myspace.com/&Mytoken=20050718121746">
<param name=quality value=high>
<PARAM NAME=bgcolor VALUE=..FFFFFF>
<embed src="http://music.myspace.com/index.cfm?fuseaction=music.player&xmlfid=5493280&s iteurl=http://music.myspace.com/&Mytoken=20050718121746" quality=high bgcolor=..FFFFFF
width="450" height="345" name="mp3player" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
--------------------------------------------------
what i want to do, is i want to put the flash player that plays, into another .swf.
So i can have a .swf, playing the flash player i already have. I guess you could say the flash player is acting like a website.
Website>Plays Flash Code
i want
SWF>Play Flash Code
Any Suggestions?
An Easy Code Problem...
Hi - I'm trying to convert the following code for a scrolling text box from code that sits on the up/down buttons and movie clip holding the dynamic text field, to code that sits on the root timeline as is recommended practise. With the code on the buttons and movie clip ("container") it works fine, but it won't work when I centralize the code on the root timeline. I'm a beginner, and can't figure out what I'm doing wrong. If someone could take the trouble of checking my code I'd appreciate it. Best Peter.
Original code that works:
Code:
/*onClipEvent (load) {
my_Txt = "Lorem...Ipsen.";
scrolling = 0;
frameCounter = 1;
speedFactor = 3;
}
onClipEvent (enterFrame) {
if (frameCounter%speedFactor == 0) {
if (scrolling == "up" && my_Txt.scroll>1) {
my_Txt.scroll--;
} else if (scrolling == "down" && my_Txt.scroll<my_Txt.maxscroll) {
my_Txt.scroll++;
}
frameCounter = 0;
}
frameCounter++;
}
*/
and on the buttons:
Code:
/*on(press) {
scrolling = "up";
frameCounter = speedFactor;
}
on(release, releaseOutside) {
scrolling = 0;
}*/
and
Code:
/*on(press) {
scrolling = "down";
frameCounter = speedFactor;
}
on(release, releaseOutside) {
scrolling = 0;
}*/
and here's the code for my root timeline, which I can't get to work:
Code:
container.my_Txt.text = "Lorem...Ipsen.";
var scrolling = 0;
var frameCounter = 1;
var speedFactor = 3;
container.onEnterFrame = function () {
if (frameCounter % speedFactor == 0) {
if (scrolling == "up" && container.my_Txt.scroll > 1) {
container.my_Txt.scroll--;
} else if (scrolling == "down" && container.my_Txt.scroll < container.my_Txt.maxscroll) {
container.my_Txt.scroll++;
}
frameCounter = 0;
}
frameCounter++;
}
container.up_btn.onPress = function () {
scrolling = "up";
frameCounter = speedFactor;
}
container.up_btn.onRelease = function () {
scrolling = 0;
}
/*this.container.up_btn.onReleaseOutside = function () {
scrolling = 0;
}*/
container.dn_btn.onPress = function () {
scrolling = "down";
frameCounter = speedFactor;
}
container.dn_btn.onPress = function () {
scrolling = 0;
}
/*this.container.dn_btn.onReleaseOutside = function () {
scrolling = 0;
}*/
thanks...
AN EASY ONE I THINK--Re-using Code; Variables
OK. I've done a few simple Flash sites now, and I'm trying to get away from all of the redundant work I've been doing.
My next task is to create one MC that loads each time you select an item from a list of, say, 20 items.
I want the text to change each time a selection is made, and I want to swap out a new image in an MC at the root level.
What I DON'T want to do is create 20 MCs and code each of them.
My text could be called from the server as TXT files I suppose--right now they are entered into flash--pixel fonts.
What is the most labor-efficient way to script this? Consider the project kind of like a portfolio section that lists 20 projects with descriptions.
Anyone?
Need A Little Help For Easy Code AS3 Please Helpme
Hello I am new in Action Script 3 and I am starting with little flash based page. But got problem on second script please help me. Here are my files:
sims3Text.as
Code:
package{
public class Sims3Text{
public static function sims3(fWord:String):String{
var sims3:String = fWord;
return sims3;
}
}
}in *.fla
Code:
var mysims3Text:Sims3Text = new Sims3Text();
sims3Text.text = Sims3Text.sims3("teeest");
but the code isnt exporting I look everything should work but nooo. Please help me
Thanks in advice.
Small Code Not Working (easy I Am Sure)
okay heres the deal i have a dynamic text box that loads 5 different text files when a user clicks on one of the buttons (but1, but2, but3...). I am trying to get it to work with the scrollbar component and i finally got the scrollbar to work but the new AS wont load the text into the dynamic text field.
so heres what i am trying to achieve. If I take the 5th line of this and remove but1.onrelease and change to load, and it loads the text fine but i need it to load when the button is clicked as opposed to just being there. What did i do wrong here???
stop();
loadText = new LoadVars();
loadText.load("contact.txt");
//creating the loadVarsText function
but1.onRelease=function() {
scroller.text = this.myText;
};
theres the AS for it this is just for one button to load the text into the scrolled dynamic text box. any ideas as to what i am missing?
I thoght maybe a funtion for the load text but i get nothing but errors so if thats it please show me what to add and where cause i cant for the life of me get it to work.
Thanks!
Ultra Easy Code Not Working ARG
Hi
all im trying to do is move a movieclip to the right when i hit the space bar this is working but i want it to stop when i realise the space bar insted its just carrying on here the code im using
var ballListener:Object = new Object();
ballListener.onKeyDown = function ():Void{
if(Key.getCode() == Key.SPACE){
nInterval = setInterval(ani, 50);
}else{
clearInterval(nInterval);
}
updateAfterEvent();
}
Key.addListener(ballListener);
function ani ():Void{
ball._x++;
updateAfterEvent();
}
Problem With Some Sound Code, Probably Easy For Ya
Hello to all,
I have the following question :
I have 2 sound objects in the same movie, which is loaded to another movie through loadmovie().
My problem is that i want to be able to control the volume of the first sound individually from the second, because the first one is a backroung music while the secong one an interaction sound. Up till now, when i wanted to use sound objects through code i used the usual methods (object.start(), setvolume...) with no problems.
The problem is that when i lower the first sound's volume, it automatically lowers the second ones too. How can this be possible since they are 2 different sound objects?
The only thing that still (i believe) could help is moving these objects in different paths. I have a diagram attached which illustrates the position of the 2 sound objects. Remember, i want the first one to drop to (say) 30% and the second one to be at 100%. How could i do it?
thanks!
[MX] Site Consept - Easy To Code?
Do you know how sites like http://www.bbdo.com and
http://www.matthewmahon.com have been coded?
I have this concept and would like to use similar navigation style.
Here's the consept:
Simplified example in the pic1.jpg demonstrates what loads first - a piece of "street" with interesting stuff on it: pics, simple animation. You can zoom to them and start loading more swf and flv files.
I quess dragging would be a good way to move the "street" around.
When you click red door (1) loads what is seen in the pic2.jpg, more "streets" and stuff to zoom to.
If you clicked all the doors you would have what is seen in the pic3.jpg, a huge map-like thing.
So, how difficult is this to code? And once all the "streets" have loaded will it become too heavy to move and scale etc.? Or, could it be done so that only the clips that are seen are playing, others don't use CPU?
Thanks!
Easy Code From A Book. But Does Not Work
Hey guys, I got this code straight out of a Flash Actionscript book but I can't get it to work. The output panel does not show an error, but the code does not do what it should. It is a mouse trail
Any thoughts, would be appreciated
Quote:
onClipEvent(load){
//CREATE 10 CURSOR FOLLOWERS
for(var i=0;i<10;i++){
_root.attachMovie("glitter","glitter"+i,i);
}
//START THE ARRAY
trail = new Array();
}
onClipEvent(enterFrame){
//MARK THE MOUSE LOCATION
cursorLoc = {x:_root._xmouse, y:_root._ymouse};
//ADD THE NEW LOCATION TO THE ARRAY
trail.push(cursorLoc);
//DELETE THE OLDEST LOCATION
if(trail.length > 10) trail.shift();
//CHANGE THE POSITIONS OF ALL CURSOR FOLLOWERS
for(var i=0; i<trail.length; i++) {
_root["cursor"+i]._x = trail[i].x;
_root["cursor"+i]._y = trail[i].y;
_root["cursor"+i]._alpha = i*10; //CHANGE BLEND TO
}
}
Site Consept - Easy To Code?
Do you know how sites like
http://www.bbdo.com and
http://www.matthewmahon.com have been coded?
I have a site concept and would like to use similar navigation style.
Here's the consept:
Simplified example in the
PIC1
demonstrates what loads first - a piece of "street" with interesting stuff on it: pics, simple animation. You can zoom to them and start loading more swf and flv files.
I quess dragging would be a good way to move the "street" around.
When you click red door (1) loads what is seen in the PIC2, more "streets" and stuff to zoom to.
If you clicked all the doors you would have what is seen in the PIC3, a huge map-like thing.
So, how difficult is this to code? And once all the "streets" have loaded will it become too heavy to move and scale etc.? Or, could it be done so that only the clips that are seen are playing, others don't use CPU?
Thanks!
ActionScript (probably Easy Error) Code
okay, the following code is for a movieClip called "ball"
it is basically a ball that moves around the screen when the user presses "up","down","left","right". and this part works okay
The added feature is that if the user presses the "a" or "A" key, the directions flip ro revers (i.e. left=right, up= down etc)
to do this i have created a variable called "one"
if variable: "one" is equal to "1", then the controls work normally (i.e. up=up, left=left etc) and if variable "one" is equal to "2" then the controls flip (ie up=down).
variable: "one" is changed value when the user presses the "a" or "A" key;
the once the movie clp enters frame:
if "one"=1 it should play function move1 (the usual moves) and
if "one"=2 it should play function move2 (upside down moves)
but this does not happen!
can anybody explain why???
Code:
var one=undefined;
watchKeyboard = new Object();
Key.addListener(watchKeyBoard);
function move1(){
if (Key.isDown(Key.UP)) {
this._y=this._y-5;
}
if (Key.isDown(Key.DOWN)) {
this._y=this._y+5;
}
if (Key.isDown(Key.LEFT)) {
this._x=this._x-5;
}
if (Key.isDown(Key.RIGHT)) {
this._x=this._x+5;
}
if (Key.isDown(97)||Key.isDown(65)) {
one=2;
}
};
function move2(){
if (Key.isDown(Key.UP)) {
this._y=this._y+5;
}
if (Key.isDown(Key.DOWN)) {
this._y=this._y-5;
}
if (Key.isDown(Key.LEFT)) {
this._x=this._x+5;
}
if (Key.isDown(Key.RIGHT)) {
this._x=this._x-5;
}
if (Key.isDown(97)||Key.isDown(65)) {
one=1;
}
};
this.onEnterFrame = function(){
if(one==undefined){
this._x=0;
one=1;
}
if(one==1){
this.onEnterFrame=move1;
}
if(one==2){
this.onEnterFrame=move2;
}
}
Refined Request For Help Formatting Code Should Be Easy
Here is what I need in plain language, please help me convert this in to ActionScript.
if next frame is loaded
then goto and stop on next frame
else goto and play current frame
basically a pause frame until the next frame is loaded?
Anyone, anyone... Voodooo economics.
Thanks, Cheers, Gratsi
Button Code Being A Real Pain - Easy One
Code:
var gallery="galleryone";
var button="tabone";
buttons.tabtwo.buttontwo.onRelease = function() {
_root.galleries[gallery].gotoAndPlay(2);
buttons[button].gotoAndPlay(22);
buttons.tabtwo.gotoAndPlay(2);
gallery = "gallerytwo";
button = "buttontwo";
};
buttons.tabone.buttonone.onRelease = function() {
_root.galleries[gallery].gotoAndPlay(2);
buttons[button].gotoAndPlay(22);
buttons.tabone.gotoAndPlay(2);
gallery = "galleryone";
button = "buttonone";
};
Ok- so the idea is that when you click a button it plays the movies assigned to the variables gallery & button to the frames mentioned.
Then the variables are changed and then when another buttons is clicked it does the same - 'except it doesn't - it does it once then sits there
I have to use variables because there's a lot more buttons..but i don't understand why it doesn't work - it seems such a simple and obvious thing to try and do - why is it so HARD???
help me...
Easy Code Problem... Help~~ Calculating Distance Between 2 Points
hm... i am trying to make an object grow and shrink according to how close the mouse is to the object, and made a pretty rough version of what i thought the code should be... but then flash doesn't do anything at all with my code... there's no errors, so i don't know where to start debugging the darn thing from... it's quite basic, so i guess there's something wrong with my code that i don't know about, and not a logic problem...
the focus is on the first 3 frames... i made a function for calculating the distance between the 2 points, then called the function within a 2-frame loop... but NOTHING happes visually...
any help would be greatly appreciated!! I am using flash MX~
attached my file...
Grouping Similar States Into Easy-to-digest Code
Here's my situation: I've got thirteen buttons that need are set from
ActionScript Code:
button1.enabled=false;button2.enabled=false;
to
ActionScript Code:
button1.enabled=true;button2.enabled=true;
etc. ad nauseum - and this will be set on each instance of the thirteen buttons. That's a lot of code! There's got to be a way to set a variable, or something, that condenses it all into one or two quick lines. But I can't figure it out, nor find it in any text or resource I've searched. I'm not ven sure how to look for this kind of thing.
So, anyone with any ideas, I'd be very grateful for the help!
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.
Grouping Similar States Into Easy-to-digest Code
Here's my situation: I've got thirteen buttons that need are set from
ActionScript Code:
button1.enabled=false;button2.enabled=false;
to
ActionScript Code:
button1.enabled=true;button2.enabled=true;
etc. ad nauseum - and this will be set on each instance of the thirteen buttons. That's a lot of code! There's got to be a way to set a variable, or something, that condenses it all into one or two quick lines. But I can't figure it out, nor find it in any text or resource I've searched. I'm not ven sure how to look for this kind of thing.
So, anyone with any ideas, I'd be very grateful for the help!
Sounds Takes Two Long To Long.. Why?
I have some sound loading from an external file, I don't understand why it takes so long to load... www.janav.com.
If you check my website three of the albums have songs...
album 6,7,8 have sound attached... but when you click you have to wait few seconds for the sound... I want to make my sound to load as fast as
www.benwisch.com website.
Any suggestions..?
I am not using linkage nor action script to load the soung I only used this code ..
on (release) {
stopAllSounds(); //to stop all previous sound
loadMovieNum("PaulinaRubio_Paulatina.swf", 2); // to load the picture first
loadMovieNum("music/paulina_music.swf",3); // to load the sound after the picture..
}
should I being using action scripts instead (like the kirupa tutorial), will this load very fast.
One more thing, the song is like 2 megabytes... should I use part of the song and then loop it.??/
Any suggestions will be appreciated...
Thanks,
Jana
Sounds Takes Two Long To Long.. Why?
I have some sound loading from an external file, I don't understand why it takes so long to load... www.janav.com.
If you check my website three of the albums have songs...
album 6,7,8 have sound attached... but when you click you have to wait few seconds for the sound... I want to make my sound to load as fast as
www.benwisch.com website.
Any suggestions..?
I am not using linkage nor action script to load the soung I only used this code ..
on (release) {
stopAllSounds(); //to stop all previous sound
loadMovieNum("PaulinaRubio_Paulatina.swf", 2); // to load the picture first
loadMovieNum("music/paulina_music.swf",3); // to load the sound after the picture..
}
should I being using action scripts instead (like the kirupa tutorial), will this load very fast.
One more thing, the song is like 2 megabytes... should I use part of the song and then loop it.??/
Any suggestions will be appreciated...
Thanks,
Jana
Long Long Load Time?
okay, I'm fairly new to Flash (newbie style) but I made a nice movie but when I load in into a page (with dreamweaver) it takes forever to load. The movie (.swf) is only 3k .... so whats the deal??
help?
'~-,_www.sketchmilitia.com_,~'
SUPER EASY / RETARDED EASY SetMask ?
Ok got a simple retarded question. I have 1 swf loading into a holder_mc and a mask_mc set with setMask but it is not working. There is nothing else to this but so help me it is not working and I know I have to be overlooking something simple but I am just not seeing it.
Heres the whopping 3 lines of code:
code: stop();
contentHolder_mc.loadMovie("home.swf");
contentHolder_mc.setMask(contentMask_mc);
Example attached.
thx
c
Easy Question, Hopefully Easy Answer...
How can i create a grid of 20 movieclips? I would like to have 4 columns and 5 rows.
Its going to be used for a drag and drop game. any help would be REALLY appreciated!!
A Little Help Goes A Long Way...
I've got an interface in Flash 5 going where the user is using a map to navigate. On this map are 6 physical locations represented by individual buildings. They are blended in to appear as illustrations on the map's surface. When a mouseover occurs the building will transition into a full color version of the building. What I want to happen next is if clicked on the building will then reposition itself to the upper left hand corner of the map and the other 5 buildings will fade out of view via an alpha transition to 0. Is there an easy way to accomplish this without a huge script. I'm just getting this stuff down and appreciate any help or direction, thank you.
TheCrocHunter
Long One
Hi there,
this is going to be a long one, so sorry to whom ever has to read it:
go to http://www.woowoos.com/eclipse and click on the first button, just to see what I'm talking about. The site is absolutely not ready, I'm only in the start-fase.
The first view is in a movie, start.swf . In that movie is the main navigation (general, timeline, future, past and shades). Above and under it there are two targets in which the two other parts get loaded.
on top (with the little cubes) is roodboven.swf
on the bottom (with the contents) is rood.swf
Here's how the navigation works:
When you click a button, the variables go like this
eg. click on about
_root.keuze = "about";
_root.bovenkeuze = "about";
gotoAndPlay("rood");
in which "rood" is the label where the first animation begins (the menu that folds). This all happens in start.swf . Then, on the last keyframe of "rood" it says
if (_root.keuze == 'about') {
loadMovie("roodboven.swf", "klein");
}
stop();
in which "klein" is the upper target. The movie loads, and on the first keyframe of roodboven.swf is says
gotoAndPlay(_root.bovenkeuze);
the movie goes to the label about, and plays the little animation (the cubes coming from the right). On the last frame of the animation it says
if (_root.keuze == 'about') {
unloadMovie("_root.stagestarget");
loadMovie("rood.swf", "_root.groot");
}
in which _root.stagestarget is a third target, and the action is to make sure it is empty when you go to about. this all works. We move on to rood.swf: On the first frame it says
gotoAndPlay(_root.keuze);
so it moves on to the label about, and should play the animation.
now the problem is that even though I haven't given any extra code, the movie goes to about, from the moment I click the button above, so it shows before I want it to, and then it showxs the animation as asked in the scripting. The action on the buttons above is:
on (rollOver) {
veldroodboven = "About";
}
on (rollOut) {
veldroodboven = "";
}
on (press) {
_root.keuze = "about";
_root.bovenkeuze = "aboutb";
}
on (release) {
loadMovie("roodboven.swf", "_root.klein");
}
in which veldroodboven is a dynamic textfield, aboutb is a second animation, but with the same actions as in the first one. It all worked in flash 5, but in MX it started to play them before I even asked it. Is there any explanation for this, or perhaps a better way to reach the same result?
I won't be mad if you choose to not solve this problem because I'm almost asking you guys to re-think my project, but if you consider not to try to solve it, please let me know anyway.
greetings, Robin
this was my first flash-project for a company, so I can't just throw it away, but I know already that this might not be the right way to make your flash movie run without problems.
|