ActionScript 2.0 :: "proper" Way Of Terminating The Else Statement?
Mar 10, 2007
My first question is using the short hand if ?: what is the "proper" way of terminating the else statement eg:
(x==1)?trace("A"):; //returns and error because no else statement defined
(x==1)?trace("A"):null; //no error but is it correct?
My second question is about the page flip
http:[url]....
In england we have these exams called GCSEs which are the first and only nationally compulsory exams in england (14>16). I am doing art graphics and I was looking into the page flip experiments. Above are the links.There are so many randomly named variables and so much random stuff that I cant understand it. For me it is not good enough to just copy and paste. I need to understand the script and make it my own. I tried creating some things using trigonometry
View 3 Replies
Similar Posts:
May 14, 2009
Having a few problems with what I thought was a simple if statement. Here is the code:
[Code]...
I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.
View 7 Replies
Sep 10, 2005
Whenever an MP3 is initiated to stream (well, progressively download really) with the mediaPlayback component, it will contue to dl to the cache until done or the browser is refreshed. The occurs even when the component has been unloaded from an empty movieclip. This is an issue when folks browse alot of MP3s on the site, because even though it's inaudible, suddenly there are many files simultaneously dl'ing to their cache. Cant find a stop stream type of command in the media class, which I think is the only class for the media components. If I were doing real streaming with the Comm Server for example, I could use stopStream.
View 1 Replies
Aug 13, 2010
Many times, each day, a notice this error in the event log :
[Code]....
each time after this error, the netconnection between the publisher and the server close. I have some log in my app who check the connectivity between the publisher and the server:
[Code]....
I just want to confirm if it's the real issue of this problem or if other thing can provide this result and how can I prevent the deconnection of the publisher if this append again?
View 5 Replies
Jul 21, 2010
ok, so a couple of months ago, while using Flash CS4, I started getting this unusual bug where the application would terminate, no error report dialog, no system reports, I didn't even get the satisfying *doonk* sound that Windows likes to make every time you try something Microsoft haven't thought of yet.
[Code]...
View 1 Replies
Aug 31, 2011
if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code
[Code]...
I dont want to copy the code from the first into the second and the first and second into the third.
My mind isn't working and there is probably an extremelly simple way to get this working.
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.
View 7 Replies
Oct 10, 2008
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);
Heres the code:
Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
[code]....
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.
View 1 Replies
Mar 30, 2011
why this code won't work
[Code]...
I'm sure you can put if statements inside other if statements, seriously I can't figure it out
View 4 Replies
Sep 22, 2010
I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.
View 13 Replies
Jul 12, 2010
what I'm trying to do is create an else if argument for each object in an array based on a user set number
Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}
to which I want it to GENERATE THE FOLLOWING CODE:
Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}
the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?
View 4 Replies
Jun 9, 2010
I'm having difficulties doing an animation here, all I'd like to do is create 30sec animation for a big screen (without sound). It needs to have an aspect ratio of 16:9 and be exported in the file format of either mov or wmv. Any recommends for settings to do this the best way?
So far I've made my flash document as large as possible at that ratio (36" x 20" ), created the timeline to 30 seconds and started importing my graphics and such. My biggest problem I've had is when I export to mov, the animations are slow and the video time is longer than what I've set. (whereas exported as avi, the animation is normal) Any ideas on how to counter this problem?
View 1 Replies
Aug 3, 2010
s there a possible issue in the way the button is made not coded?I am using Flash CS4. My buttons seem not to work. I do not think issue is in the action script (I am scripting in 3.0).Here is the way I make the button. I add a movie clip on the stage on the over state ( so if you were to double click on that movie clip a new time line would open), at the end of that movie clip there is a simple stop(); code on its own line. I do not add extra frame on the over state.Then I assign the code to the button and of course cross reference its name in the properties and everything is matching up. Just in case here is my code:
floralyte_btn.addEventListener(MouseEvent.CLICK, onClickFloraLytePopUp);
function onClickFloraLytePopUp(event:MouseEvent) :void {
gotoAndStop("61");
}
All of my buttons work fine through the Up, Over, Down, HIt stages without the problem. The functionality works fussy, some of them I have to click twice to go to the specified frame with the UILoader, some do not work at all and some work.I double checked and all of them seem to be done identical.
View 5 Replies
May 29, 2009
to get a proper content of the following xml-node:
[Code]...
what is the correct way in as3 to get the content so that the " " linebreak stays intact?
View 5 Replies
Jun 4, 2009
I am making a flash game. The game starts off running fast and smooth, however 15 minutes into the game it's noticibly slower. I worry that I am causing memory leaks by not removing objects from my game properly. I understand the whole garbage collection idea, but I still need confirmation.
[Code]...
View 6 Replies
Jan 29, 2010
I finally tried validating my website at W3C, and naturally I got 300 or so errors
As I'm knocking them out, I noticed a lot of these are from the flash embeds. Currently I'm using the traditional method[code]...
Turns out even though it still works, the <embed> tags are no longer necessary and consequently will not validate.
Tried searching around but all I could find were some pretty vague tutorials and looking at sources is nothing short of Greek at this point.
Can I get an example or two of how to properly "embed" an swf?
View 1 Replies
Dec 5, 2008
I have a scroll file, taken from a tutorial, which is linked to a class. After having customized my file I did try it and it works fine. The problem is starting when I try to import this file to an empty MCL in my website. When I have imported all the elements they do not respond and act like single pieces (es. the scroll bar is detached from the scroller). What can I do? I am attaching all the codes and I think it is the reason I cannot import a proper classed swf. The function is Event.ADDED_TO_STAGE. the only major thing is that I do not know how to change my loader class to contain this missing bit.
View 9 Replies
Nov 11, 2009
So using AS3 with Adobe Flash CS4, what is the correct way to pass a variable from a server side script "PHP" to my SWF?
View 3 Replies
Jun 8, 2010
As I understand it if I set the weak reference param to true in my event listeners I don't need to worry about removing the listeners. I'm not really clear what would cause the listener to be set for garbage collection. I would hate to have a situation where the listener was removed before I wanted it to.
View 2 Replies
Apr 7, 2012
I'm wondering if there is a proper way to upgrade from Flash CS4 to CS5. What I did was just open existing CS4 project in CS5 and saved it as CS5. It seems to work but I'm wondering: did I miss something in the transition? Do I need to make additional modifications for project to work better in CS5?
View 1 Replies
Jul 23, 2010
I'm having a bit of a problem with - what I assume to be - a masking issue. Apparently I can't post images. This may hinder my ability to explain the problem. Oh well, I'll try to make do with just words.
I have four "ground" sprites, each one shorter than the last, that are layered on top of each other. References to them are stored in an array groundLayers[], for easy reference. When a new [not ground] sprite is created - it's given a number which tells it which layers it is between. Herein lies the problem: how do I conceal the new sprites properly?
Without doing anything, they wind up all in front, not layered. My initial solution was to just change their indexes with setChildIndex(), but this proved to be disastrous when I tried to add mouseEvents to the objects. I tried to set the objects' masks to these objects, but that didn't seem to work. I also created separate layers which just contained the "sky" parts of each ground layer and setting the object masks to shoe sky layers, but that didn't work, either.
View 2 Replies
Dec 19, 2004
I have created a class to define my main navigation buttons. I would like to handle which button is clicked/pressed as simply and elegantly as possible, and I figured the best way would be to add a static variable to the class that keeps track of the current button pressed. Here's some quick pseudo-code. Code: class MainButton ext MC static var currentButton:MainButton public var sectionToLoad:String public static function getCurrentButton() public function getSection() button.onPress = currentButton = this // other button actions. // then i can check for what the currently clicked button // is and now access its variables. MainButton.getCurrentButton().getSection() etc. etc. etc. I am curious if this is a "proper" way to go about tracking the buttons. I find it is pretty elegant, but i'd rather make sure that this is a good practice of using static class variables. Also, it looks to me that all custom class definitions become a _global object?
View 1 Replies
May 10, 2007
I want to dynamically attach a class to a movieClip without using the linkage method. I choose not to because i need to pass constructor vars into it and It can have multiple classes.I want it properly attached so I can reference all the classes functions and variables through the MC. How can I do this?
View 9 Replies
Feb 27, 2008
I fixed the problem I was having with my TextArea - just as I thought, it was the CR characters throwing off the selection position. Stripping them out fixes everything. Now I have a different problem, though.My program needs to save text files as well as open them, and on a Windows machine, linebreaks are indicated with CR+LF: Wordpad is smart enough to recognize lone LFs as linebreaks, but Notepad isn't (and even then, saving the file in Wordpad will reinstate all the missing CRs). Is there any way I can detect what linebreak system is used by the OS so I can save files properly?
View 5 Replies
Sep 18, 2004
I've been reading the tutorials about doing a preloader, but I haven't found exactly what I'm looking for. Here it is: I would like to make a preloader in a specific .fla file, then load an external swf into it. How do I tell flash to get the bytesTotal not only for the preloader, but as well for the external file? Is there a special way to load the swf with a preloader?
View 2 Replies
Nov 29, 2004
I have a problem regarding the x, and y coordinates on a flash project of mine. Whenever I set the x and y coordinates for a movieClip:
Code:
function setPos() {
with (mc1) {
_x = 400;
_y = 300;
}}
The MovieClip never gets sent to the proper coordinates.
View 5 Replies
Jun 25, 2010
So I'm only 2 months into actionscript, and have been going along as I go. I've been able to figure out everything up until this point, but this is just confusing me. Right now we have games set up and a home screen to get to all the games. I have a background swf that controls the border of the site and that loads the home page in the center as soon as it starts. The way I have it set up, you get a set of movie clips that when you click on them, they unload the current swf and load the game swf.
This is where I hit the problem. In each game I have a menu where you can choose level1, level2, or level3. Clicking on the game in the main menu works fine and the main menu unloads and the game loads. When you're in the game menu and choose a level I get this error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found
[Code]...
View 4 Replies
Oct 4, 2010
I'm trying to record an audio/video program and the resulting .flv is in the wrong directory. It always ends up in application/live. I copied the sample application to application/eTutor and have the following code:
private var rtmpPath:String = "rtmp://x.x.x.x/eTutor"; private var rtmpSession:String = "0_738_0_9_6_6_2012_8_00_00_AM";
...
nc2.addEventListener(NetStatusEvent.NET_STATUS,onFMSNetStatus); nc2.client =
[Code]......
View 3 Replies
Jun 22, 2010
I am writing an ActionScript class and I don't know where the standard place to put it is.In other words, where should I put the package in regards to the hierarchy? In flash.myname.mypackage? What is the standard naming convention? As you can probably tell, I haven't had a lot of experience writing ActionScript classes :)
View 2 Replies
Aug 11, 2011
I'm trying to replace instances created by dragging and dropping into a MovieClip through Flash's IDE with actual classes so I can add them to a game loop and have them as actual entities. In other words, I'm trying to create a streamlined way to allow developers to visually add their entities to a platforming engine I'm working on.
This is my third attempt at it and I'm completely stuck.The code below loops through a movieclip that contains an exported symbol with a class linked to it named MyEntity. However, it loses its extension to BaseClass and thus doesn't move when compiled.
It inherits: MovieClip > BaseClass > MyEntity. However when compiled with the IDE it ignores BaseClass and just does MovieClip > MyEntity.
My code is designed to find and store the position of MyEntity, remove it from the container movieclip, add a brand new instance of it (with the base being proper) then set that new instance to the same position of the original.
for ( var i:int = 0; i < LayerInIDE.numChildren; i++ )
{
// first we want to get all the display objects in the layer
// these are objects that were placed from within the Flash IDE (ie. dragged and dropped into the MovieClip
var original:DisplayObject = LayerInIDE.getChildAt( i );
[code]....
This does not work.
It outputs Game.entities::MyEntity [class MyEntity] false. MyEntity is a proper class and DOES extend from BaseClass. However, the issue is the IDE weirdly removes the reference to the base class - as if MyEntity never had a base class. I cannot seem to recreate it as getting the reference to the class also returns that MyEntity never had a BaseClass. However, if I type in var newEnt = MyEntity(); instead of getting the class name through getDefinitionByName it works normally and extends from BaseClass.I need it to extend from BaseClass as that is the main class all entities in my game engine require to use.
View 2 Replies
May 28, 2010
i have created a dialpad kind of application which has a bach button at top which takes u to previous screen, a display text box and buttons. all of them are movieclips.
Now the issue is when i press down button, focus is expected to go from prevBtn->display->oneBtn, but the focus goes like prevBtn->oneBtn. Other thing is that if i press up key after going on the screen, the focus goes like callBtn->zeroBtn->eightBtn->fiveBtn->twoBtn->display->prevBtn.
one more observation is if i take the display down after all the buttons, the behavior is normal and focus goes to display.
View 1 Replies