AS3 :: Flash - Resizing As A Result Of An EventListener

Jun 16, 2010

I have coded a map that when a province object is clicked on, it should move to the center of the screen and grow a percentage of the width, along with displaying a number of different things.

The problem is that in order for the image to resize it needs to be clicked on twice. It moves, and all of the children display just as they were designed to do, but the resize doesn't work on the first click.

menuItem4_mc.addEventListener(MouseEvent.CLICK, onClick);
public function onClick(mc:MouseEvent):void {
menuItem4_mc.width = width * .65;

[Code]....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Math.round.trip - Add An Eventlistener To The Stage To Respond To A Resizing

Sep 13, 2010

I am trying to add an eventlistener to the stage to respond to a resizing. When doing so i want to keep the relative position of a movieclip-object constant to the upper and leftmost edges, without changing the alignmode of the stage to top left. This can be achieved as shown below - examplified with two classes and reference to fla implied. The problem is now: When supplying the crucial statements with a Math.round, the movieclip-object gets displaced pixelwise with each new resizing:

myMovieClip.x -= Math.round((deltaX / 2));
myMovieClip.y -= Math.round((deltaY / 2));

Whereas the solution without Math.round is rock stable so it doesn't move at all, as it is not supposed to either! Can anyone figure out why? I know it's a luxury-problem, as my use case is solved. The problem is that i don't know why? Shouldn't the use of Math.round just assure the int-value? Such a small issue could easily spoil the whole app! And i fear that i have misunderstood something fundamental in as3, and suddenly become unpleasantly surprised.

[Code]...

View 5 Replies

Actionscript 3 :: Resizing A Sprite Without Resizing Its BitmapFill (or Its Contents For That Matter)?

Nov 1, 2010

I am not simply trying to contain things and have the container resize without the contents resizing. I would just use a simple MovieClip for that.. My main focus is on the use of BitmapFill. I'm trying to make a repeating background image for a container; thus far I'm able to draw my BitmapFill sprite to the size I want. (Which is the stage's height) but when the stage is resized, I want to re-size my container but have my containers BitmapFill crop or add more as the window is resized bigger or smaller. Allow me to illustrate what I mean:

I've got a simple rectangle sprite that fills with a bitmap from the library and a simple resize handler function that detects when the window has been resized.what I would like to do is have my rectangle resize to the height of the stage.stageHeight maintaining its bitmap fill, but not resizing the bitmap fill or any children within the sprite.

From what I've read, this is a little tricky because the sprite resizes in relation to what it contains.. or.. something like that.. I really don't know any more.. I saw one example where a person extended the sprite class but I don't know why or how..

in my library there is an image called 'pattern' and my code looks like this:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);

[code]....

View 2 Replies

ActionScript 3.0 :: Smooth Resizing As Opposed Going In And Resizing Every File Manually?

Sep 11, 2009

I'm loading a few pngs/jpgs externally so they can be swapped out occasionally, and the issue I'm running into is when they are shrunk they become fairly choppy. Is there a way to have flash re-render them, or do something to smooth the resizing as opposed to going in and resizing every file manually myself?

View 1 Replies

ActionScript 3.0 :: Resizing A Sprite Without Resizing Its Auto-fill?

Nov 2, 2010

I've got a little problem with BitmapFill, I'm trying to use a sprite as a container for various things and i would like it to have a filled pattern background. my problem is that i want it to resize the sprite to the height of the window but not have the background fill resize, and add more / crop as the window size is changed. to illustrate what i mean, please view the diagram attached to this post .

I have an image in my library called 'pattern' and my code is as follows:

ActionScript Code:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

[Code].....

View 2 Replies

ActionScript 3.0 :: Flash Returns That Result?

Oct 19, 2010

I really don't understand how the results I get are possible.Here's my code:

ActionScript Code:
patch = 0;
//Assign the correct percentages using the data recovered from the database[code]..........

And, here are the traces I get:

Quote:
int_tmp: 66.6
int_tmp: 66.6
int_tmp after: 66.6[code]....

my code somehow manages to say that the result of 66.6 + 33.3 = 99.89999999999999

It might be possible in some alternate universe, but here on earth, I should get a result of 99.9... I'm really hoping one of you can explain to me why Flash returns that result, cause really, I'm at a loss here... this line:

ActionScript Code:
var int_tmp:Number = int((nbUserArray[t]/nbUserTotal)*100*10)/10;

I made sure the values are the correct ones, plus the traces confirm that the first time, it equals 66.6 and the second time it equals 33.3. So really, I don't understand how it can return this... monster of a result .

View 5 Replies

ActionScript 3.0 :: Pass Variables From Flash To Php To Process And Get Back The Result To Flash

Oct 17, 2009

How to pass variables from flash to php to process and get back the result to flash

this is th php code
<?
$money = $_POST["fname"];
$persent = $_POST["age"];

[Code]......

View 5 Replies

Flash - Keep Track Of Score, Then Give Result

Oct 8, 2010

I want to create a very simple game for school. The user chooses answers based on questions, at the end the software presents some choices to the player based upon what they said. They have to choose food they like to eat, and the game tells them about the diet, they have 9 choices.

I wonder how I should keep track of what they player chose, and how to come up with the result based upon those choices. I made it with a score, so each answer had a value, but various arrangements of answers had the same score.

View 1 Replies

ActionScript 2.0 :: Send Variables From Flash To PHP And Get Result?

Dec 9, 2009

I am new in flash actionscript... I am just starting to learn...How can I send variables from my flash project to PHP and get the resulting values back???

View 0 Replies

ActionScript 2.0 :: Getting The Result Of A Javascript Function Into Flash?

Feb 9, 2007

I have a site that has a button on it and someone did a little javascript so that each time you click the button you go to a randomly selected URL from an array of links. Now, I was told to give my flash button the same functionality. I'm not really a coder, so instead of re-inventing the wheel, I'm trying to get the result of the javascript into my action script. So far, I'm completely unlucky.

[Code]...

View 4 Replies

ActionScript 2.0 :: Search Button In Flash - Result Is Always Undefined

Apr 19, 2010

I have been trying to add google search to my flash file and when i press the search button the result is always undefined.

[Code]....

View 5 Replies

Flex :: Flash - Getting Return Result On File Upload?

Feb 8, 2010

For For some reason, I'm not getting any result returned to me when uploading a file to my server. I'm using a php script, the file gets sent, gets uploaded, but I can't get the return result.

I am firing these event listeners:
fileRef.addEventListener(ProgressEvent.PROGRESS, fileRef_progress);
fileRef.addEventListener(Event.COMPLETE, fileRef_complete);

[code].....

View 1 Replies

Flash :: Unable To Set ArrayCollection Equal To Result.Event

May 23, 2011

I'm trying to set an array collection equal to a event.result that contains an array collection, but my array collection keeps coming up null. The event.result isn't empty because I can assign it as the dataprovider for a datagrid and that works (shows data correctly)[code]...

View 3 Replies

ActionScript 2.0 :: Flash Counter - Increase With 9 Every Second And Save Result

Aug 22, 2005

I need to make a counter that will increase with 9 every second
starting point at = 1440836946
Another thing is that I need it to save the the result to view when next time.

View 1 Replies

Flash :: BitMap Eventlistener Not Working?

Jan 1, 2010

I am trying to add an event listener to my BitMap. Tile extends gameProps, which extends BitMap. I try using addEventListener. That doesnt work. but the Adobe docs say that Bitmap has an addEventListener object.

package {
import flash.display.BitmapData;
import flash.events.*;

[code].....

View 1 Replies

Flash :: AS3 Preloader Eventlistener Strangeness

Mar 5, 2011

I have a preloader that loads and attaches a swf like so: stage.addChild(loadedSWF); In the loadedSWF I have an eventlistener: stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); When a TextField added to the display list is focused the onKeyDown stops responding

[Code]...

View 2 Replies

ActionScript 3.0 :: Flash EventListener Parameters

Jun 9, 2010

Is it possible to ad more than one parameter to an eventListener? And if so, how would one go about doing so (syntax-wise). Here's what I'm trying to do:[code]I want to be able to tell the gotoNextFrame function which movieClip to control.

View 4 Replies

ActionScript 3.0 :: Flash OnClick Instead Of EventListener?

May 13, 2011

First i used to work on AS2 but i have converted to AS3 to benefit the new features .

And here is my problem : i have a function where i will create in it several buttons each one do different task but each task is so small that can be only one statement like changing the value of some variable.

Do i have to make an EventListener and a handle function for each button !! i have tried that and it made my code very messy , can't i just make something like that : button1.onClick = function(){} like AS2 ? Or is there a class i can use to make something like ?

View 4 Replies

Professional :: Passing The Result Of A Mysql Query To The Flash Banner?

Apr 15, 2010

i wish to do something similar to what is shown on the top banner of this website [URL] like passing the result of a mysql query to the flash banner.

View 1 Replies

Flash :: EnterFrame Tween Calculation Returning Unexpected Result?

Mar 2, 2010

I have the following bit of code:

protected function onEnterFrame(e:Event):void
{
var diff:Number;

[code].....

View 1 Replies

Flash :: Continuous Loop - Keep Getting The (same) Trace Result Outputted Infinitely?

Mar 16, 2012

I'm getting the geolocation data of a viewer and creating a textfield to display this data (city,state). After the data is pulled the text is measured to fit in the textbox and if the length of the city is too long, the text is adjusted in size to fill the textfield. When I trace the end result of the final text size, I keep getting the (same) trace result outputted infinitely.

[Code]...

It worked, but I needed the text box to be made according to what data was pulled from the geolocation xml, so I added it in the geolocation script.

View 1 Replies

AS3 :: Flash - Add Multiple Buttons To Stage With Eventlistener?

Feb 3, 2010

I've got as far as adding multiple buttons to the stage with AS3 and giving them unique instance names, but now I have a problem. There is no limit on the amount of buttons that could be present, there could be one or one hundred so I can't hard code.

How would I go about creating event listeners for each button? I tried pushing each instance name into an array then looping through but that gave me an error about how the buttons didn't exist, so it can't listen.

View 1 Replies

Actionscript 3 :: Flash Button Eventlistener Array Bug

Jun 11, 2010

I have an array of 12 buttons on a timeline that when first visiting that part of the timeline, get a CLICK eventlistener added to them using a for loop. All of them work perfectly at that point.When you click one it plays a frame label inside the specific movieClip and reveals a bio on the corresponding person with a close button and removes the CLICK eventlisteners for each button, again using a for loop. The close button plays a closing animation, and then the timeline goes back to the first frame (the one with the 12 buttons on it) and the CLICK eventlisteners are re-added, but now only the first 9 buttons of the array work. There are no output errors and the code to re-add the eventlisteners is exactly the same as the first time that works. I am completely at a loss and am wondering if anyone else has run into this problem.All of my buttons are named correctly, there are absolutely no output errors (I've used the debug module) and I made sure the array with the buttons in it is outputting all 12 at the moment the close button is clicked to add the eventlisteners back.[code]

View 2 Replies

Flash :: EventListener Function In Parent Class?

Jan 7, 2011

I have class ShowCase that inherite from my class ContentMC (that inherite from MovieClip). In the class ShowCase I have an EventListner that calls a function in the parent class ContentMC. But I get an error that says "Access of undefined property restoreMenuItem".

This is my eventlistner in ShowCase.as.

showcaseItem.addEventListener("CONTENTMCCLOSED", restoreMenuItem);

Here I get the error, it doesn't find the function restoreMenuItem.

The function restoreMenuItem is in ContenMC and looks like this.

public function restoreMenuItem(evt:Event):void
{
}

How do I call this function that's in the parent?

View 1 Replies

Actionscript 3.0 :: Flash - Activating EventListener For An Object

Oct 24, 2011

In my Flash program, I am trying to run a function within an object. The object uses a class called "SkullDemon.as." The function I am trying to run is called "moveSkullDemon();" this function is coded within the "SkullDemon.as" class. My main document class is "TME2d_Main.as." Within that file I create an instance of the Skull Demon class like this:

[Code]...

View 2 Replies

Flash :: Animation Not Waiting For An Eventlistener Before Moving On?

Feb 23, 2012

var playGraph = new Chart();
var playPart1 = new Part1();
var playPart2 = new Part2();

[code]....

View 1 Replies

ActionScript 3.0 :: EventListener - Loading Video Into Flash

Nov 16, 2010

ActionScript Code:
var AniLoader:Loader = new Loader();
var AniRequest:URLRequest = new URLRequest("Animation.swf");
AniLoader.load(AniRequest);
AniLoader.x = 0;
AniLoader.y = 0;
[Code] .....

I'm trying to load a video into my flash, what code can I use in the eventListener that listen to an event where the movie is finish playing? The code below just doesn't work
AniLoader.addEventListener (Event.Complete, removeAni);

View 8 Replies

ActionScript 3.0 :: Flash Removing Eventlistener From Another Scope?

Nov 20, 2010

I got this function with an eventlistener like this:

Code:

public function onScroll(denne:MovieClip)
{
Main.instance.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);

[Code]....

View 7 Replies

ActionScript 3.0 :: Flash - Add Remove EventListener Array?

Mar 1, 2012

I have an array of buttons in a public var in _model.btnArray. I want to make a function that i can pass an index number parameter that will add addEventListener to the button at that index and removeEventListener to all other buttons in the array. The function creates a tempArray:Array and assigns _model.btnArray to it. Then it addEventListener to the index passed as a parameter to the function. Then it splices the passed index out of the tempArray and then loops through spliced tempArray to remove all the EventListeners from it. which should be the listeners on all the buttons except for that one spliced. but this isn't working, its giving me an error and i don't know why.should this be working or is it just wrong?

Code:
function addRemoveEventListener(num:Number){
var tempArray:Array = _model.btnArray;

[code]......

View 1 Replies

ActionScript 2.0 :: [Flash 8] Eventlistener With Combobobx And Flash Remoting?

Mar 3, 2007

I am trying to load data using flash remoting from a mysql database via php using amfphp, i have an event listener that waits for a combobox to be used and changed, once it does, the data in there should be sent to the backend part of the system via flash remoting using PendingCall and once done should retrieve the data and place it into a second combobox. but it doesn't work.

var sectionListener:Object = new Object();
sectionListener.change = function(){
trace("1");

[code]....

View 2 Replies







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