I'm currently looking at ways to externalise all text in my flash applications into external xml files (for translation purposes). Basically, all copy in these applications has to be in two languages (English and Welsh).
At the moment, I'm just looking at a structure whereby the name of each TextField instance is the same as a field in the XML, which then has two fields (<english> & <welsh>) inside with the relevant text. The XML will be loaded in and then looped through applying the text to the textfield of the same name in the current language. There will obviously need to be some error-handling with regards making sure the names match up but this can only be done at run-time.
This seems a bit, I dunno.. lose? Is there are way of creating a better structure or system that'll be a bit less reliant on accurately naming various things so they match?
I actually got it to show up in the dynamic text box, but its also displaying my xml and css tags(The XML file structure). I know the xml and css files both work after testing them in my browser. My XML file only has one node. Below is my AS3 code:
Code: var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onLoadXML); loader.load(new URLRequest("content.xml")); function onLoadXML(e:Event):void { var xml:XML = new XML(e.target.data); //trace(xml) textBox.text = e.target.data }
I just need it to read the content and follow the css code that's been attached to it.
Why I'm getting this error in a actionscript project using flash Builder?
I'm not even embedding anything, I'm just extending an OSMF class 'NetStreamLoadTrait' which has some metadata, that's it. [ExcludeClass]
I'm using another OSMF project insted the one coming with the Flex SDK 4.0, but I have deleted the osmf package inside the SDK ( using the Actionscript Build Path )
I've been reading up on the Cairngorm architecture that Adobe recommends as best practice for devevloping RIA's in Flex.http:[url].....I recently purchased Flash CS3 and want to find a way to implement Cairngorm in my upcomming RIAs that will be built in Flash instead of Flex. I've created my own version of Cairngorm that uses almost all of the features and classes described in the Cairngorm architecture.
The biggest challenge for developing a Cairngorm architecture in Flash is that the architecturerelies heavily on Flex data binding to update the view when there are changes in the model. As far as I can find, there are no such capabilities built into AS3. This leaves me with a few not-so-desirable options.I could write my own data binding classes, or try to migrate the data binding classes from Flex.
each view class that can respond to changes in the model implements an "IBinded" interface that contains one function called modelUpdated. These classes register with a 'bind list' when they are instantiated, and any command that causes a change in the model also calls a function cycles through each registered view class, calling the 'modelUpdated' function to signify that the model has updated.This is a reasonable solution for a very simple application with very little model data, but as the application increases in complexity, it does not scale, because there is no way for a view class that is binded to an object in the model to know whether or not that object has changed - instead, EVERY view class that responds to changes in the model must check the current value of whatever objects they bind to and see if there has been an update.
i would just like to ask why is the case that when i use embedfonts = true on a textfield, the textfield's text only resizes according to the textfield's height but not the textfield's width. meaning if i make the textfield's height bigger, the text also gets bigger in terms of height, but not width, can't the embedded font maintain aspect ratio according to the textfield height?
I'm only wondering about this because this is not the case when embedfonts= false
My application uses fx tag in which it loads some xml. I want to create the xml name by binding, but I get an error that Data binding expressions not supported with attributes processed at compile time.
I have this variable in Model class:[code]I've used BindingUtils to get notified when the XML changes:[code]Function onChange gets triggered when I assign an XML to the variable, but not when I change some attribute of the XML: Model.getInstance().someXml.@attr = "newValue";
I'm trying to make a td game for fun and I need to make function to build towers and if I want to build the second tower it changes the first one... But I thought if i could change the name of the first tower's name when it builds to other var and it should be fine, but the problem is that those 2 towers will shoot together or something, so is there a way to bind functions to movieclips that are created with actionscript (addChild(Name))?
first one shows playheadtime of videodisplay and another is also used for same purpose. the difference is that when we are in add mode(decided from a flag variable) both should show current playheadtime using binding. but when we are in edit mode(again decided from flag) the latter label should remain static, to be more specific, the value retrived from database.how can I do that using actionscript. I tried ChangeWathcer but I found it a bit tricky. Is there any other simpler way or am I missing something. following is my code.
private function init():void { if (queFlag == 'a')
I want to load key/values configuration pairs stored in XML file. To bind a collection of data i know i need to use the ArrayList class, but the problem is that i want to be able to bind the loaded values using their corresponding keys and not by their indexes in the ArrayList object. For example i want to be able to do this :
[Code]...
So the question is how to bind the key/value pairs loaded form XML. I don't want to go manually set variables, i want to bind them so when they are loaded the are set automatically. Did anyone had to do something like that ?
I have a datagrid that gets its data from a webservice.When data from the webservice is retrived it calls the following function:
private function onListReg():void { arrRegOld = WSAutoreg.list.lastResult as ArrayCollection; arrReg = WSAutoreg.list.lastResult as ArrayCollection;
[code].....
The intent is when I hit a update button, it compares arrRegOld with arrReg and see if any values have changes. The problem is whenever I change values on the Datagrid it changes on both the dataProvider and on both ArrayCollections.What should I do so that the binding applies only to one ArrayCollection?
I'm having some troubles with binding data. I have an application that contains a viewstack of components. Let's say I have comp1, comp2 and comp3 inside the viewstack. Each component, has its own data class --> comp1Data.as, comp2Data.as and comp3Data.as. All values in each component are binded to the corresponding data in it's data object.
A click in a control in comp1 leads to comp3, the same goes for comp2. Clicking a control in comp2 leads to comp3. When going from comp1 to comp3, comp3Data.as is initialized and and comp3 displays the binded values. When going from comp2 to comp3, comp3Data.as is also initialized but the binded values are not displayed...
i would like to update the numbers i've added to an array from variables, when thosevariables change. is it possible change these variables and have the array update utomatically?
var first:Number = 1; var second:Number = 2; var myArray:Array = new Array(first, second);
I am using flex SDK 3.5. I have model.as and in it i have an ArrayCollection (name it arr_mod) which is Bindable.
From my mxml i link to this arr_mod in three places: 1) in DataGrid i set dataprovider={arr_mode} ...
2) in Button i add new item to the arr_mod this way: mx:Button .. click = "{arr_mod.addItem(new Item)}"
3) in textBox i want to add mx:TextBox text="{mySpecialCounterFunc(arr_mod)}" note that in the Script of mxml arr_mod is Bindable as well as in the class definition in model.as
The problem is, that when clicking on button, mySpecialCounterFunc is not called! it should be called, since i use {} and this should listen to changes in arr_mod (a change that was made in the button should cause a new item to be added.. and than the listener to respond). While The DataGrid is updated correctly! By the way, if i change arr_mod to simple String or Int it works.. i.e. mySpecialCounterFunc is called Why??
I'd like to add a derived property to flex:[code]However, derived won't update when I change a or b.Is there a better (faster) way to make derived update than giving a and b setter methods which invalidate it?added keyword "get".This makes more sense now, I hope.
Is it possible to bind a property (don't know which) of the mx:Image control, so that it is (should be) possible to get in form of a bytearray? (using Flex 4) i have to forward the bytearray to a WCF service to be stored and afterwards retrieved!
I've been kinda stuck in trying to organize data and bind them to a Repeater in one my applications.What I did at first, was to save an array of arrays, so that I could've accessed any value very easily. But then I realized that I needed to bind them to a Repeater, so I had to switch to an ArrayCollection of arrays. But the Binding issues weren't solved, since there are still arrays (not bindable) inside the ArrayCollection.Below an example of what I want to do:
<mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var arr:ArrayCollection = new ArrayCollection(
[code]....
the traces show that the array size changes, but the repeater doesn't update.
I am trying to build a flash project, where I've added a number of Datagrids to a layer and I am using masking to show only a part of the layer. And I have added custom scroll bars to scroll through the layer, so far so good. Now when I am using the scroll bar the layer seems to scroll perfectly fine but the controls on the layer are just static. Is there a way to bind these controls to the layer and scroll the entire layer with the controls. I am new to flash.
I have several components where I want to enable buttons based on passing a username to a function. I want to dynamically bind the "enabled" property on a button so that if the "somethingChanged" event fires, a button may become enabled or disabled. But, I'm not sure where to fire the "somethingChanged" event. It's possible that I may need to fire the "somethingChanged" event from several places in the application. Is this possible with a bound static function?
EventManager.as public class EventManager():void { [Bindable(event="somethingChanged")] public static function hasAccess(myVal:String):Boolean { }} [Code] .....