AS3 :: Flex - Variables Handling By AVM / Compiler / Scope

Apr 12, 2010

I have couple of questions about AS3 variables handling by AVM/compiler/scope .1. This code in Flash will throw an error:

[Code]...

but it won`t throw an error in Flex (only warning in Editor). Why?.2. How Flash sees variables in loops? Apparently this:

[Code]....

isn`t equal to just: var mc:MovieClip=new MovieClip(); var mc:MovieClip=new MovieClip(); because it will throw an error again as earlier in Flash, but in Flex in function not? Is Flash changing somehow my loop before compilation?

.3. Where in a class in equivalent to timeline in Flash - where in class I would put code which I put normally on timeline (I assume it is not constructor because of what I have written earlier, or maybe it`s a matter of Flash/Flex compiler)?

[Code]....

View 2 Replies


Similar Posts:


Flex :: Object Doesn't Look Up Scope Tree For Variables?

Aug 4, 2009

I have a simple object defined by an object literal, and have a couple functions assigned to this object. Inside the functions, I try to access global variables, and it only gets undefined. The Flex debugger tells me the variables are just right up the scope tree.Yes, I know I can access Thing by using 'this', that doesn't solve my scope issue though.Project Flex Compiler Settings: Flex SDK 3.4, Require Flash Player 10.x.Example:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="Thing.bling();">
<mx:Script>
<![CDATA[

[code].....

View 2 Replies

Flex :: Compiler 4.0 25% More Rapid Than Compiler?

Aug 5, 2011

Its stated in adobe site that the Flash Builder 4 compiler is indeed 25% more performing than the previous Flex Builder 3 compiler.

How can I confirm that?

For example if I make a simple application on Fx3 and the same on Fx4, then how would I compare the compiler performance using my project?

View 1 Replies

ActionScript 2.0 :: [FMX] Scope Of Variables In Loop?

Apr 11, 2005

Code:
var x:Number = 0;
var y:Number = 0;
var i:Number = 1;

[Code]....

i have no access to y in the (x < 600) loop... yet i gets incremented every loop.

View 2 Replies

Actionscript 3.0 :: Global Scope For Functions And Variables?

Jan 28, 2009

I was just wondering what the new method for creating global functions and variables are - the _global method has been taken out of as3

View 1 Replies

ActionScript 2.0 :: Loadvar And Scope Variable - Array Seems Set To Null Or Out Of Scope

Jul 1, 2004

I add this actionscript code on the first frame. Variables are loaded but. The question is below the code.

[Code]...

View 2 Replies

ActionScript 3.0 :: Top-level Scope From Static Scope Conundrum

Apr 2, 2010

I have a Debug class I've written, and I'd like to include a static trace() method in there, unfortunately I have no idea how to then access global / top level trace as effectively I've blocked it with the local static scope.[code]

View 4 Replies

Actionscript 3 :: Explicitly Typing Variables Compiler To Instance Of A Builtin Type Doesn't Have A Property?

May 11, 2010

I narrowed the causes of an AS3 compiler error 1119 down to code that looks similar to this:

var test_inst:Number = 2.953;
trace(test_inst);
trace(test_inst.constructor);

I get the error "1119: Access of possibly undefined property constructor through a reference with static type Number." Now if I omit the variable's type, I don't get that error:

[Code]...

So what's the deal? I like explicitly typing variables, so is there any way to solve this error other than not providing the variable's type?

View 3 Replies

Flash :: Flex - Access A Stage Instance Name From A SWF Embedded With The Flex Compiler?

Sep 10, 2009

I've embedded a MovieClip symbol with the [Embed] syntax into my AS3 project, which I'm compiling with the Flex 3 SDK. That MovieClip has instances of other clips within it that are placed on stage with instance names. I can't just access them by instance name like I would if I were compiling with the Flash IDE. How can I reference them?

View 1 Replies

Flex :: Setting Compiler.theme Option For Halo/Flex 4 In FlashDevelop?

Jul 12, 2010

Here's what works with ant build.xml:

[Code]...

I tried the following values in Project > Properties > Compiler Options > Additional Compiler Options but none of them worked:

View 2 Replies

Flex :: Flash - Wrapping Or Embedding And MP3 In A SWF Using Flex's Mxmlc Compiler?

May 13, 2010

Our Flash web-based applications play lots of audio for narration and sound-effects. Some of our customers have firewall rules that block downloading of MP3 and other audio files. So, we need to wrap those MP3 files in SWFs. In the past, I've written JSFL scripts that automate the Flash IDE and walk through a complicated, fragile set of steps to embed MP3 files into FLAs and then publish those to SWFs. Now, Flex SDK provides the mxmlc compiler. I've mixed ANT into our workflow, and command-line and automated builds have been a joy. So, I want to make transcoding or wrapping of MP3s part of our build process. I've found Embedding Asset at Compile time in Pure AS3, but this will require that I write a script to generate a wrapper class AS file. Is there a cleaner way to wrap or transcode MP3 files into SWFs?

View 1 Replies

Actionscript 3 :: Flex 4.5 Scope Between States?

May 29, 2011

I am creating an interface that has a few different states for the different steps. For those steps, there is data that I am pulling in from a database to fill certain fields. As of right now I am doing one db query to get all of the data back and want to fill in all of the fields at the same time but it is giving me "access to a null object reference".

It seems as though there is a scope issue when you are trying to access a text input field with actionscript when the state that the text input is in, isn't the current state.For Example (This would throw a "Null object reference" error):

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init()">

[code]....

View 2 Replies

Flex :: Custom Components / Events And Scope

Apr 15, 2012

I'm trapping keyboard events on the stage and dispatching custom events through a framework (Mate, though I don't know that this is an important issue), but I'm pretty confused by the scope. The structure is:application (traps keyboard events and dispatches custom event mainPanel (receives dispatched events but mainCalendar (a child element) is null on debugging. Obviously if I try to call a public method on mainCalendar it errors out, even though it's a child of mainPanel. However, mainCalendar is NOT null IF I use FlexGlobals.topLevelApplication.mainPanel.mainCalendar. Outerdocument and parentDocument do not expose mainCalendar either, BTW mainCalendar (a custom component inside mainPanel with public methods. Creation policy is 'all' and it's visible and exists long before I trap any keystrokes at the top level)Could someone take a minute and explain why the mainCalendar is out of scope when mainPanel receives a custom event, even though mainCalendar is a child of mainPanel. Is there a better way to manage the events so I don't have to always address the component via the topLevelApplication?

View 1 Replies

Flash :: Compiler To Use Both The 3.5 SDK And 4.0 SDK In Flex?

Feb 16, 2011

There are some classes that were taken out of the 4.0 flex sdk and I would like to know how to configure my compiler to use both sdk's, if it is even possible.

View 1 Replies

Flex :: Use Out-of-datagrid Scope Variable Inside An ItemRenderer?

Sep 21, 2009

I'm binding an array of items to a data grid using ItemRenderer. I use the data variable to control the bindable data. I also have someComponentVariable that need be inserted into every row but its declared at the component scope, so the data grid doesn't seem to reconize it (compile error). How can I use this variable (someComponentVariable) inside the ItemRenderer?

[Code]....

View 2 Replies

Flex - Session Handling - Flex BlazeDS Java?

Apr 16, 2011

Am facing issue with session timeout. Say for instance, the user logs into the application and he waits for 30 mins (session timeout time) and then tries to get a service through remote object.Ideally speaking, since the session has timeout the user shouldn't be able to hit the remote object, but this is happening the other way round.

[Code]...

View 1 Replies

AS3 :: FlashDevelop (Flex) And Localized Compiler Messages

Oct 20, 2009

I am completely new to the whole FlashDevelop/Flash/etc toolchain, but wanted to do some experimenting. I installed FlashDevelop and Flex SDK on my laptop, and thinks worked out just fine, except for one thing: the compiler messages are localized! Messages like "gebruik van een niet-gedefinieerde eigenschap" (Dutch.. sort of) are limiting my productivity. I don't recognize them because they look nothing like what I'm used to in any other programming environment, as a proper sentence they make even less sense than English error messages, and I certainly can't google them properly. Now I've already seen there are a couple of xml files and java/mxmlc/fcsh/etc configs I can tweak, but nothing so far helped.

[Code]...

View 3 Replies

Flex :: Locale Nl_NL In My Compiler Options?

Nov 15, 2009

I have to change the "Yes" and "No" buttons in an Alert.show(..), to another language (Dutch, for instance).
Is there a (easy) way to do that?

I forgot to mention - I have a -locale nl_NL in my compiler options, but it is still Yes/No

View 1 Replies

Java :: Get The Flex Compiler To Work With A 64bit JRE?

Jun 2, 2010

Are there any workarounds to get the Flex compiler to work with a 64bit JRE? If I use an MXMLC task in an Ant buildfile in Eclipse it works fine but if I try to use MXMLC from the command line (or try the Run... command from FDT in Eclipse) it fails, telling me ...

"Error loading: C:Program FilesJavajrrt-1.6.0jreinjrockitjvm.dll"

(this is with a 64bit JRockit runtime but that shouldn't matter).

View 1 Replies

Flex :: Compiler Warns Me That Binding Will Not Work?

Apr 11, 2007

The Flex application below generates the compiler warning: Data binding will not be able to detect assignments to 'dp'. This seems correct since the variable 'dp' is not a bindable property (there is no [Bindable] metadata tag). I have added a button which appends items to the back of 'dp' when it is clicked. Although the compiler warns me that I will not see changes to 'dp', the list shows the new item every time the button is clicked! I do not understand why I can see new items appear in the list. Can someone explain why this still works although 'dp' is not bindable?

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" minWidth="955" minHeight="600">
<mx:Script>

[code].....

View 1 Replies

Flex :: Why Is The Compiler Complaining About A Possibly Undefined Property

Jan 3, 2010

I have a very simple practice program for Flex 4 ( Gumbo ).

[Code]...

Why does it think that cPicker is static? Or that cPicker.hexValue is undefined? Also it seems that even after importing the ColorPicker library in the code using the import keyword, I somehow have to import it on the commandline for building as well. Is that correct?

View 1 Replies

Flex :: Does Compiler Automatically Optimize Embedded PNG Assets?

Jun 29, 2010

I was trying to further reduce the filesize of a SWF file by optimizing the embedded PNG graphics (using ImageOptim tool). To my surprise, this didn't yield any effect, so I created two test Images:

Original (433883 bytes)
Optimized (273723 bytes)

When embedding either of these assets in a simple ActionScript project, the compiled SWF is ~274kb in size. Which raises the question: Does Flex optimize embedded PNG assets during compile-time? If yes, is there some documentation about the optimization going on? It can't be because of the SWF compression alone, because zipping the images doesn't reduce filesize at all.

Here's the Code for completeness:
package {
import flash.display.Sprite;
public class SizeTest extends Sprite {
[Embed("/assets/original.png")]
private var ImageAsset:Class;
public function SizeTest(){
}}}

View 2 Replies

Flash :: Flex - Compiler Arguments - Force SWC Inclusion

May 2, 2011

I'm trying to write a compiler argument for FDT to force the inclusion of one of my SWCs. It looks kind of like this (App name changed, but the real one also contains mixed case and a space): -include-libraries "C:WorkspacesMy Applibssite.swc" Problem is that the compiler claims it is unable to open this file. Is there a problem maybe with using a full path like this? Ideally I would prefer to use a token to represent the project folder, something like -include-libraries "${project}/libs/site.swc", but I don't seem able to find a token list in the docs.

View 1 Replies

ActionScript 3 :: Referring To External Source In Flex Compiler

Jan 27, 2012

Is there a external-source-path option available in Flex compiler similar to external-library-path? My requirement is that, I am building a "SWC" file but I don't want to include certain folders inside my 'src' folder as these are anyway available in my other application during run time. (Trying to be resource constraint). So, I want to use these folders during compilation but do not want to include them in the generated "SWC" file.

View 2 Replies

ActionScript 3.0 :: Flex Compiler - Embedded Fonts Not Working

Jun 5, 2010

I cannot get embed fonts working Everywhere I look it says to do it like I am doing it below, but it doesn't work. I am using FlashDevlop with Flex compiler. There are no error messages. I have tried taking everything out of the Embed directive and adding it in one by one, but no affect.
When I use the system font, it works.
When I use the embedded fonts without setting embedFonts to true, I get TimesRoman.
When I use embedded font with embedFonts to true, I get nothing.

ActionScript Code:
package fontManager{
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
[Code] .....

View 5 Replies

Flex :: Keyboard Event Handling?

Jul 31, 2009

I'd like to arrange things so that I have a chain of keyboard event handlers in my flex application, all of whom are queried when key down events occur. Basically, when a visual component is on screen, it is a candidate for handling a key press event. Something like this (clearly this is pseudocode):

<application handles_keys="F5, F6">
<tabGroup>
<tab1 handles_keys="pgup, pgdn">
<control handles_keys="0,1,2,3,4,5,6,7,8,9" />

[code]...

I have a class written that will respond to the key events the way I want it to, so how do I register one or more instances of this class to have the results I want? Also, note that there are some situations where this class should receive events that would ordinarily be handled by a UI component. The TAB key is the main example; I have a few cases where I want my key down event handler to fire even when the focus is on a text field.

View 3 Replies

Flex :: Http - Handling Redirected URL Within App?

Apr 1, 2010

We have a Flex client and a server that is using the Spring/Blazeds project. After the user logs in and is authenticated, the spring security layer sends a redirect to a new URL which is where our main application is located. However, within the flex client, I'm currently using HTTPService for the initial request and I get the redirected page sent back to me in its entirety. How can I just get the URL so that I can use navigatetourl to get where the app to go where it needs to?

View 2 Replies

Flex :: Handling Timezone Offset?

Jun 28, 2011

I've developed an FLEX application for distributed data administration. When our Asian employees specify a date, it will be saved +1 day.If I check my timezone offset it is +60, their offset is +520.

var dNow:Date = new Date();
trace("Your time zone offset: " + dNow.getTimezoneOffset() + " minutes");

I assume this is the problem? If so, would you suggest that I correct the entered date by 460 minutes before sending it to our server for saving? How to do that?

View 2 Replies

Flex :: Specify Linked Resource Folder In MXMLC Compiler Arguments?

Oct 13, 2011

I've got external folder with resources (graphics, movies, etc) which is shared between a couple of projects. I'm able to link this resource folder in FlashBuilder (as described in [URL]). After that all the paths to embeds are relative to the project, and that's the behaviour I want.

This linked resource appears in .project file as follows:
<linkedResources><link>
<name>resources</name>
<type>2</type>
<locationURI>DOCUMENTS/Shared/resources</locationURI>
</link></linkedResources>

Note, that it isn't source folder and it is not included in compilerSourcePath tag. The question is how can I specify resource linked folder in mxmlc command line arguments? -source-path is not working here, relative pathes to embeds can not be resolved.

View 1 Replies

Flash - Flex Compiler Appears To Misinterpret .as Files As MXML?

Nov 21, 2011

After changing the Flex SDK to 3.6 (from 4.5.1) so as to target Flash player 9.0.124, the project no longer compiles, producing spurious errors such as XML does not have matching begin and end tags leading me to believe that the compilation process is 'borked'.

This is a pure AS project, and so should have no dependency on the Flex SDK, howver, it seeems to be inextricably linked to the Flex 4.x SDK and Flash Player 10+. I have tried swf-version and -target-player-version in the compiler arguments, but there is still something I am missing to get this to compile for Flash player 9.

View 1 Replies







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