ActionScript 2.0 :: Loop SlideTo Is Not Working As Expected?

Jan 16, 2007

In the following code, I create 12 buttons, label them, and control their onRollOver,onRollOut, and onRelease actions. Everything is working fine except for the line containing the "slideTo" method. Reading from the two arrays for the x and y values, it appears to be inserting the largest number in each array instead of stepping through all 12 values. Currently, clicking on any of the buttons moves the object (ralphMC) to x=100 and y=800. I am pretty stumped about this, as I've inserted quite a few various numbers into each array during testing. Can anyone tell me what I am doing wrong?slideTo is part of the mcTween package, in case anyone wanted to know. code follows:

Code:
//Creates an array of numbers that will evenly space the buttons out vertically
var mcPosY:Array = new Array();

[code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Array/loop Not Functioning As Expected

Oct 8, 2009

I have a series of MC's (ultimately about 55) which I'm performing some actions on when a user hovers over the MC.

Code:
var items:Array = [
UnitedStates,
Brazil,

[Code].....

All my variables and paths test correctly; but, when I test the swf, if I hover over _level0.item_0, _level0.item_2 is the MC that received the actions. As I add more MC's, it's always the last MC that receives the behavior. To clarify though, the _visibility and _alpha values do set themselves for all of the MC's. It's just when a user hovers over _0 and _1 that nothing happens to the clip being hovered and _2 receives the order to execute the tween.

View 5 Replies

ActionScript 3.0 :: Mouse Controls Not Working As Expected In IE?

Mar 31, 2010

I am developing a simple galaga clone for my site, its at [URL] . You will notice the controls work fine in firefox, opera, safari, chrome, etc. However, in IE, the controls are only triggered if the mouse cursor is hovering directly over the player ship.

The playership object is created in the main document class which passes a reference to the stage to the playership class.

private var ourShip:playerShip = new playerShip(stage, ourHUD);

Which is then added to the stage from within the document class (gameMain)

stage.addChild(ourShip);

The playership class then monitors the mouseX and reacts accordingly. The code for the ship controls which are linked to the enter_frame eventhandler is

Code:
public function controlShip(e:Event):void {
var a1 = stageRef.mouseY - e.target.y;
var b1 = stageRef.mouseX - e.target.x;
var radians1 = Math.atan2(a1,b1);

[Code]....

View 2 Replies

Flash :: Gallery Template Not Working As Expected?

Jul 6, 2009

I have created a flash gallery using the in built template in Flash8, which works fine. The gallery forms part of my gallery page of a separate SWF flash site. I load the gallery using a loder component. Since the gallery navigation works by targeting the root folder, my site gets screwed up. The question is, how do i modify the ActionScript in the gallery.fla file (flash inbuilt template), so that once loaded into the main site, it doesnt target the root timeline, but targets its own timeline i.e.Please see below for the code in the Flash Gallery. PS: I didnt write the code - its inbuilt into the template:

function updateFrame (inc) { // send slides to new frame newFrame = _level1._currentFrame + inc; _level1.gotoAndStop(newFrame);
updateStatus();

[code]......

View 1 Replies

Flex :: MouseEnabled Where Transparent Not Working As Expected

Feb 28, 2011

I just cannot understand why mouseEnabledWhereTransparent does not work on this skin. The Skin this creates is basically a Button with a transparent background and a little triangle to the left side, like so: >ButtonText But the empty space around the Triangle does not receive mouse events. I've tried wrapping another group around the triangle path and I've tried wrapping it into a Graphic Object, also without success. I could create a Rect with 0 alpha below everything, but isn't that exactly what mouseEnabledWhereTransparent should be doing?

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="[URL]" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fb="[URL]" minWidth="21" minHeight="21" alpha.disabled="0.5" mouseEnabledWhereTransparent="true">
<!-- host component -->
<fx:Metadata>
[Code] .....

View 2 Replies

Actionscript 3 :: Using Graphics.clear Not Working As Expected?

Mar 12, 2012

Would anyone know why using graphics.clear(); in this example is preventing the graphics from being drawn?

e.g. the following code works and the lines are drawn.

var my_shape:Shape = new Shape();
my_shape.graphics.lineStyle(2, 0x00FF00, 1);
addChild(my_shape);

[Code]....

I'm wanting to animate the line moving so would like to clear the previous drawing before redrawing the lines.

View 1 Replies

ActionScript 3.0 :: Try/catch Statements Working But Not As Expected?

Aug 21, 2009

I've got some try/catch statements in an XML parser I've written that don't seem to be doing what I want them to be doing.

The code:

ActionScript Code:
try
{[code]........

The problems:

-In the case the type is analysis or info (with other tags being alright) the "Default Text" is staying blank, even without a text tag.

-If I purposely malform the option tag, no alert window shows up and none of the other properties in the catch block (optionText,selType, etc.) get set properly

View 3 Replies

ActionScript 3.0 :: Flash Buttons Not Working As Expected

Dec 23, 2011

I've followed this tutorial and made a functional photo gallery.

Now, I want to add that photo gallery on my site. I've created a flash button and assigned it this action:

Code:
on (release) {
_root.contents.loadMovie("Pictures.swf");
}

"contents" is the container movie clip, and "Pictures.swf" is photo gallery i've made. Now, when i click on button, Pictures.swf does load (arrows are being shown), but when i click on them, nothing happens.

View 4 Replies

Flash :: BitmapData.draw ClipRect Not Working As Expected?

Jun 29, 2011

I have a component that contains 4 layers: (in ascending depth order) bgImage:Sprite, dropZone:Sprite, dropMask:Sprite and line:Sprite. The bgImage is at 0,0, and the other objects are placed at various positive coordinates. dropMask is masking dropZone.At the point of bitmap capture I want to only draw from the dropZone and dropMask layers, so I'm trying this:

removeChild(bgImage);
removeChild(line);
var bmd:BitmapData = new BitmapData(dropMask.width,dropMask.height,true,0);
bmd.draw(this,null,null,null,dropMask.getBounds(this));

Despite the dropMask being located at 50,60 the capture always starts from 0,0. I've also tried getting the boundary rectangle and forcing the x,y, but it makes no difference. should I just forget clipRect and use a matrix instead?

View 2 Replies

ActionScript 3.0 :: Stage RemoveChild (Target) Not Working As Expected

Nov 7, 2009

I'm new to AS3 and have been making a Snake game. I've come up with a problem with the code (Yes, I have magically created problems trying to program Snake...It's going to be a long day). My problem is, with removeChild...I'm getting strange errors being throw at me. Not only that, but my Movieclip (myFood) is not being removed entirely, only the visuals of it are.

That being said, here is, what I believe to be, the most important chunk of code for this problem, along with the error it gives me.
Code:
/*
* Code for the Snake and whatnot extras.
* Also, Snake and Food are classes.
*/
var myFood:Food = new Food();
stage.addChild(myFood);
function snakeEatFood() {
[Code] .....

View 2 Replies

ActionScript 2.0 :: Execute ScaleTo And SlideTo?

Aug 2, 2004

I've read all the documentation, but I'm still not clear on 1) the syntax of these and 2) how to execute them.

[Code]...

View 1 Replies

ActionScript 2.0 :: Rotating An Object Within The SlideTo Method?

Jun 9, 2007

I'm using the mc_tween2.as tween class and the slideTo method for moving objects around on the screen.

What I'm trying to do is to have the objects rotate "x" degrees when clicked. Right now, they move, let's say, 20px across the x-axis. But I want it to move 20px while rotating 15 degress clockwise. Is that possible using this method?

I know there's a way to rotate objects using the _rotation feature, but that doesn't move it using any tweens; it just "snaps" it into place. I'm looking to rotate the object using a tween, while sliding sliding around using the slideTo method.

View 1 Replies

ActionScript 3.0 :: For & While Loop Not Working

Jan 23, 2009

PHP Code:

var trail1:MovieClip=new trail_1;
var trail2:MovieClip=new trail_2;
var trail3:MovieClip=new trail_3;

[Code]....

This is what I want to happen but attempt at making a for/while loop gives me this:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at momentum_fla::MainTimeline/frame1()

PHP Code:

var i:Number = 1;
while(i < 7){
var NameTemp:MovieClip=new ["trail_"+i];

[Code]....

View 5 Replies

ActionScript 3.0 :: Why One 'for' Loop Working Other Not

Feb 4, 2010

Why does the first loop work but not the other?[code]

View 5 Replies

ActionScript 3.0 :: HitTestObject Is Not Working With Loop

Jan 6, 2009

I have a project I am working on in Flash CS3 using AS3.I have a drag and drop quiz that contains 8 boxes. 4 of the boxes contain dynamic text boxes with the vocabulary words. 4 of the boxes contain the definitions to the vocab words. The students drag and drop the vocab words onto the definitions. My issue is that hitTestObject is only working on the first box everytime. I have a for loop in my endDrag code that should loop through each object and test against it to see if there is a hit. Can anyone see anything wrong with my loop?

View 2 Replies

ActionScript 2.0 :: OnRelease Not Working Within XML For Loop

Jun 30, 2010

I have set up the XML as follows:

[Code]...

View 5 Replies

ActionScript 2.0 :: SetTextFormat Not Working In Loop

Dec 21, 2011

I create 30 text fields dynamically on the stage and want to set text format for all text fields. I use 'setTextFormat'. It works fine for single text box. But not working if I give this in loop. See the code below. It creates thirty input text boxes on the stage. But it assigns text format only to the last text box. When code Copied and placed in frame 1. The stage size should be 800 x 600. Execute the program and type in the last text field. I want that to happen for all text boxes.

ActionScript Code:
var xtpos:Number = 10;
var ytpos:Number = 10;
var i,j:Number=0;
var depth:Number = 100
var k:Number=0;
[Code] .....
In the above it traces only the last text field.

View 3 Replies

ActionScript 2.0 :: Flash 8 - For Loop Not Working

Feb 24, 2007

I am having some trouble with some code. buttons are not working.
Code:
menuLoc = new Array("menu_main", "menu_philosophy", "menu_portfolio", "menu_resume", "menu_contact");
for(i=0; i < menuLoc.length; ++i){
_level0.navMenu.menuLoc[i].onRelease = function() {
trace("hit");
}}
The array has the instance names of the movieclips which are located in navMenu.

View 9 Replies

ActionScript 2.0 :: Load Movie Loop Not Working

Feb 25, 2009

I'm trying to create a "for" loop to load thumbs into existing movie clips using the following code:[code]This should load thumbs 9-17. The trace shows the variable is incrementing but I'm not getting the thumbs to load.

View 2 Replies

For Loop Dynamic Number Feed Not Working

Jul 16, 2009

I'm loading a variable from a .txt file into flash (per client request).The variable is as follows &ClientNumberOf=4 so the variable = 4, this works on trace, happy, joy When I try and add the variable to my for loop..[code]I've tried a slew of different options...(for example)var newVariable: Number = ClientNumberOf; Nothing works, again, trace works, but script fails to work when I try and dynamically set the loop?!

View 1 Replies

ActionScript 3.0 :: Working With Multiple Instances - For Loop?

Dec 17, 2011

I'm very new to Adobe Flash CS5.5. Can you create a common instance EG: "Enemy" and then control it like so:
Enemy.x += 1;
So that all instances of Enemy will move forward one pixel each frame? Instead of just one enemy? If this is not possible could I set up some sort of array of enemies like you can in C and try something like:
int EnemyNo = 1;
for(EnemyNo = 1; EnemyNo < 5; EnemyNo++) {
Enemy[EnemyNo].x += 1;
}
Does Flash even support "for" loops?

View 21 Replies

ActionScript 2.0 :: Generating Textfields In A For-loop, Not Working?

Nov 21, 2005

Why doesn't this work?

[AS]
times = 6;
for (i = 0; i <= times; i++) {
_root.createTextField("txt" + i, _root.getNextHighestDepth());
_root["txt" + i].text = i;
trace(_root["txt" + i]);
}[/AS]

It works for empty and library-linked mc's but not textfields...

View 2 Replies

ActionScript 2.0 :: For Loop In Array Not Working Properly?

Dec 1, 2005

Code:
var temp:Array = new Array();
temp[0] = 0;

[code].....

View 6 Replies

ActionScript 2.0 :: Password Check Loop Isn't Working?

Nov 2, 2003

i'm trying to check the passwords and names and i want it to goto the next frame if they match, security isn't really an issue so i'm not going to go through php and mySQL and stuffhere's the code:

Code:
on (release) {
i = 0;

[code].....

View 3 Replies

ActionScript 2.0 :: CS3 GetNextHighestDepth - Inside Loop Is Not Working Properly

Apr 5, 2010

i have attached the flash file and also xml file. Here i duplicate the movieclip, first for loop is working perfectly but inside of second for loop is not working properly.

View 5 Replies

ActionScript 2.0 :: GetNextHighestDepth - Inside Of Second For Loop Is Not Working Properly?

Apr 5, 2010

i have attached the flash file and also xml file. Here i duplicate the movieclip, first for loop is working perfectly but inside of second for loop is not working properly.

View 0 Replies

ActionScript 3.0 :: Loop - Buttons Stop Working After A Certain Point?

Sep 27, 2011

The problem is my buttons stop working after a certain point. Now I think it's because I need some kind of loop somewhere, but I'm not too sure. I've included a trace in the code so I know the button is not working anymore. (At least the function of what I want it to do).

[Code]...

View 0 Replies

ActionScript 2.0 :: For In Loop Isn't Working - Doesn't Change The Alpha Of Anything

Apr 15, 2008

I have a class file that contains a for in loop. basically there are 50 states (movieclips) on the stage and here is what I have:

[Code]...

I don't think I understand enough about arrays or for in loops to understand why this isn't working... it traces the array, but not statesArray[states], and it doesn't change the alpha of anything.

View 1 Replies

ActionScript 2.0 :: Function Only Working On Last MovieClip Created Within Loop?

Aug 2, 2008

As the title suggests, I cant get function at end of the code to attach to each MovieClip I create dynamically within a loop.Only the last image will follow the mouse. What am I doing wrong? Im really not sure.

Code:
//now do something with the xml data
PopulateLists = function(final_array)

[code]....

View 4 Replies

ActionScript 3.0 :: Working With Movie Clip Alpha In For Each Loop?

Mar 20, 2010

How can i change movie clips apha property slowly one by one in for each loop? I can't undestand what's wrong((( From XML data i create for each loop, where my MC creates. But i can't chang their alpha property slowly. When i'm trying

Code:
mc.addEventListener(Event.ENTER_FRAME, alphaShow)
function alphaShow(e:Event):void{
e.target.alpha += mcAlphaPlus;

[code]....

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved