ActionScript 3.0 :: Conditional Statements For Click Referring To Loaded Swf

Jun 10, 2009

The last big hurdle I have, is the following, and I hope someone can just throw me a bit of guidance on this.I am looking for a way to write a function, that on click of my "next" button in the main timeline, will refer to my loaded swf MovieClip(imageLoader.content) telling it to go to the next frame label, so really a compound if/then situation - just referring to the loaded file throws me.So, my next button is "pNext," and what I am looking for is something along the lines of:[code]

-if (loaded movie) is on frames 12-144, then go here (on click),

-if (loaded movie) is on frames 144-155, then go here (on click)

View 8 Replies


Similar Posts:


ActionScript 2.0 :: Flash 8 - Using This With Conditional Statements

Sep 28, 2010

When use the full path name and the identifier of a movie clip, my conditional statement works fine. However, when I swap the identifier out with "this", it no longer works. This script is contained within the movie clip I am trying to reference. I have found that, "this" works fine by itself on the timeline. It just stops working when I place it within a conditional statement.

Here is my script:
function functionOne() {
randomX = 550*Math.random();
randomY = 400*Math.random();
} functionOneInterval = setInterval(functionOne, 1000);
function functionTwo() {
[Code] .....

The reason I am trying to use "this" instead of the identifier name is because the movie clip it is referencing will be duplicated. This script here generates a random destination point for an enemy spaceship and tells it to constantly move to the changing points. This script is contained within the enemy spaceship movieclip, and I am planning on duplicating several of them at once.

View 1 Replies

ActionScript 3.0 :: Conditional Statements With Numbers?

Jan 25, 2010

I want to write AS3 code that has 2 variables;  one that acts on odd numbers and the other that acts on even numbers entered into a text field ?(sorry I'm not making much sense here! Will explain the context further)I'd like to use an XML calendar in my Flash project that shows the odd or even dates in the calendar depending on what number you enter in a field being either an odd or even number. (This is based on ACT Water Restrictions odd and even watering restrictions)It means that if your street number is an odd number you can use water as per restrictions when the date also is an odd number. Similarly, if your street number is an even number you can water as per restrictions when the date also is an even number. You're probably familiar with this system.
  
The context is for my Adult Migrant students to understand the concept of our water restrictions here which is governed by this odd and even system.So what I'm doing to do next is buy a cheap XML calendar online which I can adapt for my project but I'm not sure whether I should be approching this code problem with an  if/else statement to get the results or something else?how to write the code!!
 
if my number I enter is an even number then display (in an XML calendar) even days
else
if my number I enter is odd then display (tin an XML calendar) odd days

View 5 Replies

Flex 3 - Conditional Statements For A Repeater

Jul 12, 2011

I have an xml file that has a start date and length of a project... I use a repeater to load each project. The users' screen only shows 2 weeks at a time. I would like to make it so that if a project doesn't fall within the two weeks on screen, that the project isn't loaded. I could do this by sorting through the XML and finding the correct projects to load, and putting them into an array collection, but there's a "move date" button which allows the user to change the two weeks that are showed. Once the two weeks are changed, I would need the projects that fit into that new 2 week window to show.

[Code]...

View 1 Replies

Actionscript 3.0 :: Color Conditional Statements?

Aug 8, 2010

I'm having difficulty getting a conditional statements to recognize a statements equality even if the condition exists

Even if movieClip_mc is 0xA6A6A6 then the function will not execute:
Code: Select allvar myColorTransform = new ColorTransform();
myColorTransform.color = 0xFF0000;

[code].....

View 2 Replies

ActionScript 2.0 :: Conditional Statements For Arrays?

May 22, 2007

I'm trying to call movieclips depending on the data in the array, but I can't seem to get the conditional statements right, so that it works

var outfitArray:Array = new Array;
//Set function parameters
function createArray():Void {

[code]......

View 1 Replies

Professional :: If Else Conditional Statements For Dynamic TextFields

Nov 29, 2010

This is about a self assessment quiz.There will be four options and each one has a scale from1-5 i.e., "option a" has 1mark, "option b" has 2marks,"option c" has 3 marks, "option d" has 4marks and "option e" has 5 marks and we count the answered and we display the score for example if there are 20 question in it if they answered "option e" 5 times the score will be 25 and option d 5 times the score will be 20, and if "option c" for 5 times the score will be 15,and "option b" for 3 times the score will be 6 and "option a" two times the score will be 2, and we add up all the score and display in a dynamic text field called "score" and the total score is 68.

And I have another dynamic text field called "tsc" where I have to display the tags like excellent , good, better ......etc. Till now every thing is fine but I am unable to compare them it is displaying excellent even if i get 10 marks. If the score is greater than 55 "tsc" should display Excellent, if the score is greater than 41 or less than 55 "tsc" should display Best, if the score is greater than 26 or less than 40 "tsc" should display Better,if the score is none of the above "tsc" should display Poor.

This is my code on the submit button:
on (release) {
gotoAndStop("sQ");
if (scor>=55) {
tsc = "Excellent";
} else if (scor == 41 && scor<=55) {
[Code] .....
Where:"sQ" is the frame name where i am displaying the score details"scor" is the var name for the dynamic text field for displaying total score"tsc" is the var name for the dynamic text field for displaying the tags llike good, Excellent, better, poor.....etc.

View 4 Replies

ActionScript 3.0 :: Using One Series Of Conditional Statements For Several Different Objects?

Mar 13, 2012

-Let's say you have several doors on stage for a game.
 
-Each door has the ability to change color.
 
-When any two doors are the same color, a player can move between those two doors.
 
To do this, I use code similar to the following:
   
doorThree.addEventListener(MouseEvent.CLICK,dooraction);
function dooraction(event:MouseEvent){
if ("Blue") {

[Code]....
 
Is there a way to use this one series of If statements for all doors, or must I copy and paste the same instructions for each door instance? In the game I'm planning, each door actually has more than two dozen states, so if I can use just one series of if statements, I'd like to do that.

View 3 Replies

ActionScript 3.0 :: Use Input Text With Conditional Statements?

Jul 9, 2009

I'm extremely new to AS3, and programming in general, and so hopefully this will be a simple problem someone can help me solve. I'm trying to have a user input a number in a text box, and then depending on what they input, take them to a different frame. (it's a math quiz, and the users are answering an addition problem). I think I need to define the variable type of the text box somehow before the code will work, but I'm not exactly sure what to do or how to do it.[code]...

View 3 Replies

ActionScript 2.0 :: Conditional Statements With Keyboard Events?

Jul 14, 2009

I'm trying to load and unload UI Component based on the using pressing UP. When they press the UP key i want the UI component to load a specific image. When they press it again I want the image to be unloaded. And if they press it again I want it to be loaded again, etc...Currently when I press the UP key it loads the image but it never unloads.Here's my current code:

Code:
var count:Number = 4;
var evenOrOdd:String;

[code]....

View 2 Replies

ActionScript 3.0 :: Forcing Code Execution Order In Conditional Statements?

Feb 17, 2010

I have created an image gallery where each "slide" is an image loaded by one UILoader component. Everything works, except I noticed that as a user it is annoying to wait for each new slide to load.So, even with my limited knowledge of AS3, I decided to figure out a way to load the next upcoming image before the user requests itone for odd numbered slides, one for even numbered slides. That way, when the user is viewing a slide with an odd number in the first loader, the next image can be loaded into the second (currently invisible) loader and ready to go when requested button would simply toggle the visibility of these two loaders.

function nextButton(event:MouseEvent):void
{
imageNumber++;

[code].....

View 11 Replies

ActionScript 3.0 :: Using Mouse Events (mouse Leave) For Conditional Statements?

Dec 14, 2010

I have a menu drawer at the edge of the screen that shows when the user rolls the mouse over it, but if the user overshoots it an moves the cursor slightly outside the browser window this is unfortunenatly registered as a mouse out.

I want to stop this by using event.MOUSE_LEAVE, but i need to use it as a condition not to triger a "leaveHandler".

View 3 Replies

ActionScript 3.0 :: Conditional Click States - Toggle Button?

Jun 25, 2009

I have a button hit state called btnWorkH, below is the start of my code to make it functional. The idea being, that when someone clicks the button, I add a child to the top, to make it look like it has been clicked and is maintaining an alternate color. How would I code this so that it becomes a toggle? As, I need a click (once this action has been performed) that removes the child... just not sure how to write the condition for this.

btnWorkH.addEventListener (MouseEvent.CLICK, workClick);
function workClick (e:MouseEvent):void{
addChild (workO);
workO.x = 62.5;
workO.y = 109.3;
addChild (txtAmy);
txtAmy.x = 105.1;
txtAmy.y = 109.3;
}

View 7 Replies

ActionScript 3.0 :: Set Up Conditional Adding / Removing Btn Alternately On Click

Dec 17, 2009

I have this code: btn_nav.addEventListener (MouseEvent.CLICK, navPop);function navPop (e:MouseEvent):void{themIn = new Tween (btn_them,"alpha" ,None.easeOut,0,1,10,false);}I need to set up a conditional adding / removing this btn alternately on click - just not really sure how to approach that.

View 3 Replies

ActionScript 3.0 :: Conditional Statement For Loaded Swf?

May 14, 2010

I am initiating loading a swf file, "bg1.swf". I have a button that, when clicked, is suppose to check to see if "bg1.swf" is loaded.I cant figure out how to write the conditional "if" part.  Currently, instead of checking to see if my statement is actually true, it executes loading bg1Req?  Here is the code .

var bgLoader:Loader = new Loader();
var bg1Req = new URLRequest("bg1.swf");
var bg2Req = new URLRequest("bg2.swf");

[code].....

View 7 Replies

ActionScript 3.0 :: CLICK In Main Timeline Goes To Where Click Is Designated In Loaded Swf?

Jun 13, 2009

I have a loaded swf slide show, within that slideshow, I have assigned "next" and "prev" buttons to advance and back up my slide shows via frame labels ("oneIn") for instance... here is an example:
 
btn_next.addEventListener (MouseEvent.CLICK, nextClick); 
function nextClick (e:MouseEvent):void{    this.gotoAndPlay ("twoIn");}
 
I would like this function to run when I click a hit state on the main timeline above it. So, how would I trigger the above function from a click on the hit state on the main timeline?

View 13 Replies

ActionScript 2.0 :: If Statements Within If Statements?

Oct 7, 2004

If they get a question wrong in my quiz ( weakest link) the money clip goes to zero and it goes onto the next question. If they get it right the money clip advances and they go onto the next question. I want to include each time that it should only go onto the next question if all questions have been asked. SO i want an extra if clause in both sections, saying if current question is more than 11 go to '#game over"The questions are saved in the frame of the quiz

_root.qArray = new Array("question: A;B;C;D")
_root.qArray.push("Question?:A;B; C; D")

There are 11 questions.At the moment at the section with choosing answers I have

function selectAnswer(n) {
// correct
if (answers[n] == correctAnswer) {
_root.money.nextFrame();

[code].....

View 1 Replies

Flex :: Dispatch A Click Event At The Top Of A Loaded .swf?

Jun 15, 2010

So I'm trying to build a tool that will allow me and other users to all open the same .swf, and then I as the Admin user am able to interact with mine while they all see my mouse movements and button clicks etc on theirs.I'm using BlazeDS to manage this and I'm getting data sent back and forth etc - no difficulties there. The issue I'm running into is this:

In an "Admin" instance, I click a button. I capture that X and Y, then tell Blaze to tell my clients to dispatch a Click event at that X and Y. On my client side, I get that data and dispatch a Click event at that X and Y - but the click is actually caught at the stage level. The click on my client side takes place UNDER all of my buttons and other content - so the whole thing fails.Is there a way to tell it to start the click event at the top?

View 3 Replies

ActionScript 1/2 :: Fire Click Event To A Swf Loaded Dynamically?

Nov 24, 2009

I have an swf converted from powerpoint, the version is in flash 8, and i want to fire a click event on that swf to advance in the slides, how can i perform this action?

View 4 Replies

Professional :: Click Detection On Button Once New Picture Loaded

May 11, 2011

In my following code "Btn.onRelease" doesn't work after "LoadImg()" was call, How can I solve this, because I want to detect a click on Btn once the new picture was loaded.

Here is my code :
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
function LoadImg() {mcLoader.loadClip("images/p0.jpg", Btn);
}LoadImg();
Btn.onRelease = function(){trace("onRelease");
};

View 1 Replies

Actionscript 3 :: Flash Double-click An Externally Loaded SWF?

Mar 18, 2010

I've got a class (which extends MovieClip) that loads in an external SWF (made in pdf2swf). That is added to another class which has declared doubleClickEnabled = true and I'm listening for DOUBLE_CLICK events.Problem is when the SWF is loaded my code picks up no DOUBLE_CLICK events, only CLICK events. I've tried it without adding the SWF to the stage and it does pick up DOUBLE_CLICK events.

class ParentClass{
...
public function ParentClass(){
...
mcToLoadSWF = new MovieClip();

[code]...

I've also tried adding the event listener to the mcToLoadSWF as well. No dice.

View 1 Replies

As3 :: Flash - Wait Until Image Loaded On Button Click

May 6, 2011

I have a slideshow that loads image files with the BulkLoader class from here. When the first image is loaded completely, it gets added to a MovieClip container to add it to the stage.. and it gets displayed fullscreen, but only if a button is clicked:

fullScreenButton.addEventListener(MouseEvent.CLICK, showFull);
function showFull(e:MouseEvent):void {
stage.addChild(mcSlideHolder);

[Code]....

This works fine unless the fullScreenButton is clicked before the image is loaded completely, then of course nothing is visible. How do I get button click event that calls showFull() to wait until the image is loaded/added to the container or how can I add it again? What is a possible/the best approach?

I tried dispatching a custom event "firstImgAdd" that adds the image again to the container when the fullScreenButton is clicked, as well as with a try/catch block or even a simple if condition but none of them worked, meaning the image does not get added to the container after it has finished loading when the button is clicked too early.

View 2 Replies

ActionScript 3.0 :: Unloading Externally Loaded SWF On Button Click?

Mar 19, 2011

I'am developing a Custom Player for SWF's,...the SWF's are loaded externally.I've added functionality so as to load next SWf if next_btn is clicked and previous sef if prev_btn is clicked.Now, whats happening is that, the sound of the loaded swf is still playing in the background if another swf is loaded along with the loaded swf's sound.I'am thinking that if I'am able to remove the loaded swf and then load the next swf, then this problem will be solved,...I just don't know how to unload it.My code so far is...

var Xpos:Number = 0.0;
var Ypos:Number = 0.0;
var swf:MovieClip;

[code]....

View 3 Replies

ActionScript 2.0 :: Get The URL's From The Loaded Text File To Be The URL When You Click A Button

Nov 30, 2005

I have a flash MC that is loading in a text file. In that text file there are URL's. I also have inside the flash MC several buttons. How do I get the URL's from the loaded text file to be the URL when you click a button.

View 1 Replies

ActionScript 3.0 :: Externally Loaded SWF Files On Click And Automatically

Aug 3, 2010

I am creating a slide show that loads external SWFs on a button click as well as switching slides automatically.. This is pretty much the exact example of the functionality:

[URL]

I have the action script that loads external SWFs on a button click, but I don't know how to make it so that the slides switch after a few seconds on their own as well as on a button click. I know it has to do with a timer - but I have no idea how to do that (i'm super new to AS) Here's the code I'm using so far:

var Xpos:Number = 0;
var Ypos:Number = 0;
var swf:MovieClip;

[Code].....

View 1 Replies

ActionScript 3 :: Getting Index (Click Event) Of Loaded MovieClip Image

Jan 11, 2011

I am loading a set of thumbnail images from an array [hard coded] into a movieclip symbol on the stage. I have two arrays with the thumbnail and the full size image having the same index number. In many examples, "event.currentTarget.contentLoaderInfo.url" returns the full path to the image selected. i just want the index number. Adobe does not make is easy to figure out what other properties are available to me from the contentLoaderInfo. Is 'SelectedIndex' or something like that available? Where does an inspiring AS programmer find the contentLoaderInfo properties and or methods available? Is url the only thing that us usable here?

var thumbnails:Array = ["tn_2010OpenHouse_00.jpg","tn_2010OpenHouse_01.jpg"];
var images:Array = ["2010OpenHouse_00.jpg","2010OpenHouse_01.jpg"];
var thumbX:Number = 10;
var thumbY:Number = 623;
var loader:Loader = new Loader();
loader.load(new URLRequest("images/" + images[0]));
addChild(loader);
loadThumbs();
[Code] .....

Output:
Index= -1
Index= -1
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

View 2 Replies

ActionScript 2.0 :: Referring To URL In XML?

Dec 21, 2006

This is my problem: I've got a couple of movieclips, when I click on them I want them to open the URL that I've typed in my XML-file.(The photos are thumbnails stored inside of the movieclips)Here's my XML:

Code:
<?xml version="1.0"?>
<select name="photos">
<option photo="film14" url =">[code]....

How do I refer to the url-code in the actionsscript?

View 4 Replies

Professional :: CS4 Referring To A Label

Feb 20, 2010

Now that I've set labels, I'm trying to create actionscript code to go to the labels. Here's an example of my code:
 
btn_me.addEventListener(MouseEvent.CLICK, gotome);
function gotome(event:MouseEvent):void{    gotoAndPlay(me);}
 
This code has been borrowed from the online video - Getting Started 18: Building an Application. Of course, in that video explicit frame numbers are used so the code looks like gotoAndPlay(15). I'd prefer to use labels for obvious reasons. My question - how do I tell Flash that 'me' is a label? I expect I need to use a special character and I've already tried gotoAndPlay(#me) but that gives me a Syntax error.

View 3 Replies

ActionScript 3.0 :: Referring To A Movieclip?

Nov 23, 2009

i need to refere to a whole bunch of mc named a1, a2, a3, a4, a5 and var who:MovieClip="a"+3 dosnt work...

ActionScript Code:
import gs.TweenLite;
stop()[code].............

View 1 Replies

ActionScript 2.0 :: Referring To Another Object?

Apr 12, 2010

I have a small Flash file where I control a ball.In ActionScript 2.0, I have it to where this ball moves around based on input from the Arrows on the keyboard. It also bounces off the edges.I added a new separate ball (not the same symbol) and I want to refer to the NEW ball's X and Y coordinates to see if I am running into the new ball. How do I refer to the other ball's (or any other object for that matter's) properties from within the ActionScript of the first object?

View 2 Replies







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