Actionscript 3 :: Writing A Flex Precompiler - Similar To The Way MXML Is Done Into Build Process?
Oct 14, 2011
This is a bit of a crazy question, but does anyone out there know how to go about writing an extra compile step into the flex compiler. The idea would be that the MXML compiler would knock out the MXML to AS3 code as it does, but we have an extra step between the AS3 code and the bytecode.
The reason why I ask, is that this would be a great step to handle things like metadata tags to make code changes. A common practice in a lot of frameworks is to have an [Inject] tag before a variable. I.e. [Inject] public var user:IUser.
I've noticed that, recently, builds in FlexBuilder have been taking much, much longer than they used to (30 or 40 seconds, as opposed to 3 or 4). What is the simplest way of profiling these builds to figure out what is taking so much time?
I am adding a different listener to each button in the menu and there are several menus as well, then each one of those functions adds a different child depending on the button and also pushes several values to the Array list, in this example called objectsOnStage. I will be running this structure function 40 times with each of the highlighted elements changing accordingly.
//Listener and function for Button01 menu01.button01( MouseEvent.MOUSE_DOWN, button01Function); function button01Function(event:MouseEvent):void {
[code]....
My original thought was to keep all those changing values in an Array list and run a loop for the function/listener, but I just cant make it go.
I am writing an AIR application through which I want to open a native process 'wordpad.exe' and write data generated in the AIR application to a document.
The wordpad application opens with a blank document but it generates an error Error#2044: Unhandled IOErrorEvent:.text=Error #3128: Error while writing data to NativeProcess.standardInput.
I've been experimenting with Dynamic Streaming while in the process of writing a tutorial. The documentation is quite clear on a few points: The keyframe interval in the various encodings should be shortThe bufferlength should be at least 2x the keyframe intervalThe player should sense a bandwidth change, by default, within the 4-second sampling interval and call for a switch. Then, the switch could take as long as 2x the keyframe interval after that. What I'm finding is wildly different behavior than this. It takes anywhere from 10-15 seconds for the player to notice the change and call for a switch, then another 20-40 seconds for the switch to happen. When switching up to a higher bitrate stream, this just means the user gets low bitrate video for longer than they ought to. But when switching down due to falling bandwidth, the buffer runs out and the user stares at the rebuffering sign for a lengthy time - long enough to give up on watching the video, for sure.
I've encoded an H.264 MP4 file at 64, 384, and 768 kbps, at 30fps and an "every 60 frames" keyframe interval. I've streamed it rtmp via two different CDNs that use FMS 3.5, into two different Flash video players (JW Player and Flowplayer). I've restricted my bandwidth on Windows XP with Netlimiter 2.0; and on the Mac with 'ipfw'. I've set bufferlength between 4 and 10 seconds. I've tested switching up and switching down. For up, I start with a 200kbps bandwidth limit. The video starts OK with the correct stream, then at 5 seconds I open up the bandwidth to unrestricted. For testing down, I do the opposite: start at unrestricted and then at 00:05 restrict to 200kbps.
My test page, with both players and sample code is at [URL] n-flash-bitrate-switching/ I also have a couple of screen recordings there showing the behavior of the whole process, both switching up and switching down. I thought I've done everything right here - paid attention to every documented detail, but it works rather poorly. Can someone explain whether this is expected behavior, if the players have implemented dynamic switching poorly, or if I'm doing something wrong?
I'm using HaXe to make a few simple SWFs for RTMP video streaming. Everything is working great, but what I'd really like to do is tokenize a few properties so that the SWFs are compiled with environment specific properties ALA Ant.
[Code]...
I've poked around in documentation and on forum posts and can't see how to do this, though I'm sure it's possible. anyone point me in the right direction?
Note: I considered using flashvars and managing the address in the web application, but that seems less efficient. If that's the better way to handle this please explain why.
Currently I am building an application that launches crtmpd (a rtmp server written in C++).
Whenever I launch the application from within Flash Builder it works great, if I install a release build from an air file the process.start() returns a generic "could not start process" error.
The crtmpserver.exe is stored in applicationDirectory and the config file is kept in applicationStorageDirectoy.
So I've moved it to the native storage directory. But the problem persists. I've found the following though:
startupInfo = new NativeProcessStartupInfo(); startupInfo.executable = binFile; processArgs = new Vector.<String>(); processArgs.push(luaFile.nativePath); startupInfo.arguments = processArgs;
In the IDE after this startupInfo is setup correctly. On client machines all properties of startupInfo are still null.
Does MXML get compiled down to as3 and then converted to flash bytecode? Also, is there a significant performance penalty to compiling mxml vs compiling as3?
I am working on a custom Flex 4 component which is an aggregation of two existing flex components. I would like to be able to specify my own custom properties for the component as well as access the existing public subcomponent properties via MXML. For instance I might want to adjust the font color or style for the label and text input. toy component which aggregates both a label and a text input:
I am trying to override a Button class, i have a few properties which i wish directly initialise with the mxml description of the component, like :[code]which function is triggered ( in order to override it ) when all properties with mxml description is fully initialised with their values ?
In TFS 2010 build, I have a new build and I want to call an ant script that builds Flash. How do I call the ant script? Also How can I compile the Flash directly? I've seen the Power Tools and this question but it doesn't help me as we don't have TFS 2008. I can't find any documentation on how to use the power tools except the 1 sentence on the bottom of download page saying to create your build the old way and import it (which isn't very helpful). I've installed the power tools on the agent computer but I don't see any new options in the Toolbox when I'm designing the build flow.
I just started working with ant a few days ago. Right now I have a general buildall.xml which should call each project's build.xml. Because some projects depend on each other, I need to rebuild some other projects which depend on it. This isn't a problem--I'm just setting the depends property of the target. However, ant is always building the dependencies, even when the files haven't changed.Let's say project1 has no dependencies; project2 depends on project1; project3 depends on project1, 2; project4 depends on project1, 2, and 3; and so on.I could hack a solution which looks at project K, and checks if project 1 .. project K have updated files using uptodate. If so, then run the target. This is messy and appears unnecessary.
What is the cleanest way to implement this?EDIT: So I decided to just hack in a bunch of targets, "check_projectK" where it does the uptodate checks on all of its source files, its build file, and the build files of the 1 .. K-1 projects. Due to dependencies, this is always handled correctly. However, this is still a large amount of copy and paste for a large workspace.
What I'd like to do: create an MXML component with some children, then extend it via MXML to create a new component with more children, without losing the original set.In other words
create a component bc.mxml <?xml version="1.0" encoding="utf-8"?> <s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
A Flex components values are initlized by init methord. In an application flow, How to refresh a mxml component data value ; as init is callled at the start up it self only.
eg. of mxml componet may be as simple as button label or text as complex as repeater whose data provider is a web service ( means a fresh quesy should be made to pull the data and refresh the dataprovider of repeater )
suppose i have 3 buttons(for example say, productin, marketing, sales ) on my main.mxml..once i click on one button it should take me to abc.mxml page with production data, once again if i click on second button it should take me to the same abc.mxml but with marketing data. same as for 3rd button also, how can i achieve this ?
I've been trying to create a custom mxml component that extends another custom mxml component (i.e.MyMXMLComponent -> BaseMXMLComponent -> Group). I've been reading that trying to add visual children to MyMXMLComponent caused error with Flex 3 but that's no longer the case with Flex 4.
What I want to know is whether this is a supported/fixed/documented feature of Flex 4? or just some undefined behavior in Flex 4 that may get changed with future updates?
if this is supported and documented feature, does anyone have link pointing to adobe document stating it as such?
This is a project I'm working on for a simple demo tutorial application in Flex. I am using mxml pages. You can see to the left that I will have my main application and then other mxml files (In the Examples Package) as the examples that will be loaded into the main application mxml. How can I dynamically pull the value from the object in the list to load the child mxml file into the container that I have further down in the application?
I have a Flex AIR2 application which uses native process to run CMD.exe. Application running fine on WinXP, Win R 2008 server. But not running on VISTA 64 bit OS. Flex not able to run CMD.exe when application installed in C:Program Files (x86). When I run application as Administrator mode it is working fine. Below is my code, I want to start cmd.exe as Administrator.
I am writing a Flex application for use on a private intranet with no external Internet access. I want to use Google's 3D Maps Flex API, but it must be connected to the internet to download map tiles on demand.
Is there a way to locally cache the 3D map tiles and data so that I can run this app without an internet connection? And if not, is there a 3D GIS that supports Flex integration and allows for a local map cache?
I would like to include an MXML file in my MXML file in the same way you can include an external file in AS3 using the include directive. Using the include directive brings the code from the external file into the original file at compile time placing it in the same scope. For example,
I posted the same question but I think it was not so clear. Now I am rephrasing my question with real problem.I have a flex application. It is basically a web application. On it I have a player that play avi files and some buttons and tabs along side.The application also have recording button that records that direct stream from an IP cam and store that stream on the media (USB). How can I automate function testing of such application. Like I have confusion that when I press the recording button but can I be sure that recording starts? I have tried RIATest and flexUnit 4.
if someone presses ctrl +alt +delete or any kind of shutdown hook from any os and delete the flex process from task manager then how can i track from that flex process application that killing that flex process was activated so i like to do some processing before killing this process.
I create a Flex Desktop App by Flex builder 4. I want to log some debug info into a file , named by process id //var pid:int = NativeApplication.nativeApplication.getPid() ?? var logFile:String = "/var/log/MyApp_"+pid+".log"; Is these any API to get pid in Flex/ActionScript3?
It could run a native process in an adobe air application by enable extendedDesktop. But if create an flex library, does it support running an native process. If yes, how to configure it?
I'm looking for suggestions regarding implementing process flow / work flow management in a PureMVC based application. Our Flex application includes a number of processes such as account creation, payment processing, etc. Within our team, there is some discussion of how rigidly we should adhere to the PureMVC model. Within the PureMVC model, it seems reasonable that the current state in the process could be managed in a Proxy. Commands are clearly responsible for processing the actions required of each node and for node transitions. Mediators for managing the UI.
However, I think that there is an important bit still missing here: a ProcessController. The approaches we've reviewed all seem to either violate the PureMVC model (even just slightly) or make unreadable code. A proxy would maintain the state of the process. As such, it seems to be an appropriate way to implement the controller. However, this is putting a lot of business logic into the proxy.