[SPAM] Re: [flexcoders] Passing an object to a rendererProvider
--- In flexcoders@yahoogroups.com, Jeffry Houser j...@... wrote: Tracy, I understood from the original e-mail that he was using a component as an itemRenderer. If his 'item object' is being used an itemRenderer he would have to create numerous mods to the list based classes to pass in properties other than data or listData. That's what styleFunction on ADG is for. And why the Data Visualization Components take things that would be properties on other components (like dataProvider) as styles.
[flexcoders] Re: Subclassed DataGridColumn does not render in FB3 design view mode
--- In flexcoders@yahoogroups.com, fourctv four...@... wrote: [Flex 3.4] I am subclassing DGC in a library of mine. Everything works perfectly, no problems in runtime. But FB3 does not render my columns... If I have a mix of DGC and MyDGC on a DG, the framework's standard DGC render well, mine don't. If I have only MyDGC in a datagrid, it shows as an empty grid, as if no columns were declared. But again, it works fine in runtime. Is there any trick, setting or property I need to set in my manifest.xml or design.xml? I know that DGC rendering in FB3 is done differently than other components. Is there a way to do what I want? You need to package it in a swc and program for the design time view. HTH; Amy
[flexcoders] Re: Problem sorting advancedDataGrid after dataprovider updated
--- In flexcoders@yahoogroups.com, InvertedSpear invertedsp...@... wrote: Problem Solved... I guess. I was turning my HTTPService result into an XMLList. I just switched it to an arrayCollection and I no longer loose the ability to sort when I refresh the data. Maybe there is some limitation when using an XMLList, I wish I could have found out for sure, but at least I have a working product now. Lesson Learned: use arrayCollection, it's apparently a superior veriable type. XMLList, unlike, say, XMLListCollection, is not a ListCollectionView, so it doesn't generate the proper events to allow anything bound to it to know that something has changed. HTH; Amy
[flexcoders] Wonky alignment in mx:htmlText property (Flex 3)
I think the MXML is more readable for a TextArea if you use the mx:htmlText property, but I found that I got a giant left indent on the first line and unexpected line breaks in the TextArea (with a giant indent again) when I used it, whether I included any markup in the property or not. If I use the inline htmlText attribute, everything works fine. Why is there a difference, and has anyone found a workaround? I tried setting XML.ignoreWhitespace, XML.prettyIndent, etc., but nothing helped. Thanks; Amy
[flexcoders] Re: TileList custom ItemRenderer - commitProperties not called when selection changes
--- In flexcoders@yahoogroups.com, Greg Hess flexeff...@... wrote: Hi All, I have a custom item renderer in one of my TileList's. I need to set a style of one of the children to indicate selection, I am doing this by overriding commitProperties. However, when debugging the IR's commitProperties does not get called after the selection changes. I'm pretty sure that the styleFunction on the TileList_withStyle at flexdiary.blogspot.com gets called when the selectedItem changes. IMO, it's much cleaner not to have the itemRenderer making decisions about style. HTH; Amy
[flexcoders] Re: Flex Data Grid Question
--- In flexcoders@yahoogroups.com, InvertedSpear invertedsp...@... wrote: Apologies for resurrecting a somewhat old thread, but since my searches turned me up here and I spent several hours today working on this issue I thought it would be appropriate. Here's is the code I came up with that mostly solves this. My source data is just a basic XMLListCollection. The renderer colSpanningHeader is a basic label component. I did nothing but make it align center ... I find one problem with this, I can't completely get rid of the first column. It makes my grid look a little tacky. Anyone out there know how I can get this same method of grouping without showing the first column? I don't want a folder tree, I just want a header row for each group. Set the treeColumn to an AdvancedDataGridColumn with 0 width?
[flexcoders] Re: Odd DragOver Problem
--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: Double check your logic about when you call acceptDragDrop Also, are you overriding createChildren? If so, please post your code.
[flexcoders] Re: How can I use Grouping collection to group data on the parent ?
--- In flexcoders@yahoogroups.com, Thomas Silvester thomas_...@... wrote: Please Can anyone help me out? There's a GroupingCollection example at flexdiary.blogspot.com. It's not an exact match for what you're asking, but you might find that it helps point you in the right direction. HTH; Amy
[flexcoders] Re: AMFPHP problem
--- In flexcoders@yahoogroups.com, Pete pe...@... wrote: As you probably know, NetConnection.Call.BadVersion means that an error was thrown in the php script, usually a syntax error, but your script runs fine on other servers. I would suspect something in the php config on the server is causing you trouble. I have the same problem every time I move to a new server because I try and transfer too much info and not enough memory is allocated ro running php scripts on the server. Also, check to make sure your PHP version is not too old or too new. http://flexdiary.blogspot.com/search/label/Remoting http://gfxcomplex.com/amf/amfphp-is-dead/ (read the comments for a possible fix) HTH; Amy
[flexcoders] Re: Get strong propertyName from object so it would break at compile time if changed
--- In flexcoders@yahoogroups.com, tntomek tnto...@... wrote: Is there a way to get a strong property name from an object? scenario ... Person class having weight property var column:DataGridColumn column.dataField = weight; can i do something like: column.dataField = Person.weight.getPropertyName(); ... so that if this weight property is renamed one day I would get compile time warning? You can look for Person.hasOwnProperty('weight') to see if the property exists at runtime. If you want a compile-time warning, just put in a hard reference somewhere to aPerson.weight. HTH; Amy
[flexcoders] Re: Building components at runtime
--- In flexcoders@yahoogroups.com, prodanzr tendan...@... wrote: Hi all Thanks to the success of my first Flex application I've been asked to write a new one that is required to build the user interface from XML data it receives from a server. So the app sends a request to an HTTP Server and gets XML back that signifies such things as username, string, maxlength=40; startdate, date and so on from which the app would build a component and display it, capture values and send them back to the server. So far all my (limited) Flex work has been MXML-specified user interfaces so I'd like to ask if people think this idea is hard to implement in ActionScript (I assume it's doable) and if there are any examples anywhere I could look at? Check out http://www.insideria.com/2009/10/dynamically-creating-classes-f.html http://www.insideria.com/2009/10/interfaces-and-dynamic-class-i.html
[flexcoders] Re: Help with Arrays, ArrayCollections Repeaters
--- In flexcoders@yahoogroups.com, criptopus sd_br...@... wrote: I'm trying to get these X's to appear in a circle and not having much lock with it. The array seems to work when I trace it but nothing appears on the screen. I tried just defining an MXML ArrayCollection and it worked but I want them Bindable so I can move them about. Code so far... ?xml version = 1.0? mx:Application xmlns:mx = http://www.adobe.com/2006/mxml; xmlns = * layout = absolute creationComplete = makeChange(); mx:Script ![CDATA[ [Bindable] private var myLabels:Array = new Array(); private function makeChange():void { var i:int, cx:int, cy:int; for (i = 0; i 36; i++) { cx = 200 + 200 * Math.sin(i / 18 * Math.PI); cy = 200 - 200 * Math.cos(i / 18 * Math.PI); myLabels.push({ label: X, x: cx, y: cy }); } } ]] /mx:Script mx:ArrayCollection id = myLabelsAC source = {myLabels}/ mx:Repeater id = myLabelsRep dataProvider = {myLabelsAC} mx:Label id = nameLabel x = {myLabelsRep.currentItem.x} y = {myLabelsRep.currentItem.y} text = {myLabelsRep.currentItem.label} fontSize = 20/ /mx:Repeater /mx:Application Any help appreciated as I am just a learner. Arrays aren't bindable, so mx:ArrayCollection id = myLabelsAC source = {myLabels}/ Doesn't update when you change the array. Manually set the source property on myLabelsAC at the end of your function. HTH; Amy
[flexcoders] Re: RemoteObject question/mystery
--- In flexcoders@yahoogroups.com, Wally Kolcz wko...@... wrote: Looking for a little education from all the people smarter than me of remoteObjects. I have always used the MXML version which includes the resultHandler attribute which made managing the returned data easy. However I never learned the AS version very well. I can create the remoteObject in AS and call its method, add the EventListener, but how do I actually get the data back to a caller function? index.mxml import org.mywindow.data.Users; [Bindable] public var users:ArrayCollection; public function getMyData():void { users = Users.getAll(); } for the User's getAll function I have something like: UserDAO.as ... public var _users:ArrayCollection; public function getAll():void { var UserDAO:RemoteObject = new RemoteObject(); UserDAO.destination = ColdFusion; UserDAO.source = org.mywindow.data.userDAO; UserDAO.getAll.addEventListener(ResultEvent.RESULT, resultHandler); UserDAO.getAll.addEventListener(FaultEvent.FAULT, faultHandler); } public function resultHandler(e:ResultEvent):ArrayCollection{ _users = e as ArrayCollection; return users; } I know some of the code may be off, but I am trying to understand how a non called function (resultHandler) can return data to the called function in a different class. So my question is, if the index.mxml calls the getAll function in the UserDAO class, will the getMyData function still receive the ArrayCollection from the resultHandler? If I were to fire this off, till the result be that my users ArrayCollection in the index.mxml be populated in the end? Thanks! You should never ignore the kind of compiler warning that you ought to be seeing here (implicit coercsion of ResultEvent to possibly unrelated type ArrayCollection). The first thing you should do is put a break point inside resultHandler and look at the e object in the variables window, to see what property of it might contain the ArrayCollection you're looking for. Then cast e[thatProperty] to ArrayCollection explicitly. The next thing you need to realize is that the code that is calling your event handler is deep in EventDispatcher, and it does not give a flying, er, hoot, what your function returns. In fact, I'd be really suprised if you are not getting a compiler or at least a run time error with your code as it is. Event handler functions should _always_ have a return type of void, which means that in your result handler you either need to work with the AsyncToken on the result (which you'd set up when you call the RemoteObject) or you need set a variable or call a function which both your result handler and whatever needs to use it have access to (in their scope). For more on using AsyncToken, see http://flexdiary.blogspot.com/2008/11/more-thoughts-on-remoting.html . HTH; Amy
[flexcoders] Re: Casting down an object
--- In flexcoders@yahoogroups.com, bnsmeets bensme...@... wrote: Hi all, I'm wondering if it is possible to 'hack' some sort of downcasting into AS3. The context is, that I am using a generated webservice proxy from Flex 3, and want to be able to add custom (extra) properties to the generated valueobjects without having to adjust the code that parses the wsdl result into objects. So e.g. the webservice generates the class: class A { property A; property B; } I have my own class that is: class B extends A { property C; } When i call the generated webservice get all A's, it will return an array of A objects, what I am looking for is to convert that list into B objects. So the values of the properties that exist in the A counterpart, filled for a new B instance, with an empty C property. Instead of having B extend A, instead have both A and B implement Interface I. Then use the Decorator pattern (there's a current feature on this on InsideRIA http://www.insideria.com/2009/10/decorator-design-pattern.html if you don't have the book AS3 Design Patterns) to have B wrap an A and reflect the properties that I requires it to have. So package { public interface I { function get prop1():String; function set prop1(s:String):void; function get prop2():String; function set prop2(s:String):void; } } package { public class A implements I { private var _prop1:String; private var _prop2:String; public function get prop1():String { return _prop1; } public function set prop1(s:String):void { _prop1=s; } public function get prop2():String { return _prop2; } public function set prop2(s:String):void { _prop2=s; } } } package { public class B implements I { private var _a:A; private var _c:String; public function B(a:A) { _a=a; } public function get prop1():String { return _a.prop1; } public function set prop1(s:String):void { a.prop1=s; } public function get prop2():String { return a.prop2; } public function set prop2(s:String):void { a.prop2=s; } public function get c():String { return _c; } public function set c(s:String):void { _c=s; } } } Now, any code that needs type information, you'll be looking for I, not A, because a B is not an A, it contains an A. For more on Interfaces, check out http://www.insideria.com/2009/10/interfaces-and-dynamic-class-i.html or http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of-swfloader.html . HTH; Amy
[flexcoders] Re: how may I store values to function's arguments? REFdn7045338143
--- In flexcoders@yahoogroups.com, dennis den...@... wrote: Some times, the one result of a function is not enough, cay we use the arguments to get back values from them? internal function getXY(x:int,y:int):void{ x=10;y=20; } internal function test():void{ var x:int; var y:int; getXY(x,y); trace(x: +x.toString()+ y: +y.toString()); // here I get x: 0 y: 0, I want to get x: 10 y: 20 } For instance, in c the getXY should be like this: internal function getXY(int* x, int* y):void{ x=10;y=20; } Try: private function getXY(x:int, y:int):Object { return {x:10, y:20); } private function test():void { var obj:Object = getXY(0, 0); trace('x: ' + obj.x + ' y: ' + obj.y); ] HTH; Amy
[flexcoders] Re: addChild doesn't effect for some reason REFdn2065133102
--- In flexcoders@yahoogroups.com, dennis den...@... wrote: In small test application I have the follow object. stack The Main.mxml loads the EntryClass.as - class EntryClass (that doesn't extends anything) - public static function Main(). This EntryClass.Main() function is doing the follow: var mxmlApp:Application = Application(Application.application); var mainAppClass:MainAppClass=new MainAppClass(); mxmlApp.addChild(mainAppClass); So the mainAppClass is loaded. Now the MainAppClass extends the UIComponent and in its constructor does this: var buttonFromMainClass:Button=new Button(); buttonFromMainClass.x=20;buttonFromMainClass.y=20;buttonFromMainClass.label= hello world; to add it to stage I call addChild(buttonFromMainClass); and here is the problem! The button is not appeared on the stage, but using this code: Application(Application.application).addChild(buttonFromMainClass); the button is added to the stage and it is visible. Why the button is not added to the stage with the simple addChild? Where am I wrong? This seems like a roundabout and probably inadvisable way to do this, but you might want to try calling setActualSize() on buttonFromMainClass. If that doesn't work, post back with more info on when and how you're instantiating the class. HTH; Amy
[flexcoders] Re: Flexbuilder doesn't give compile error when using a undeclared variable, methods
--- In flexcoders@yahoogroups.com, benjamine_df benjamine...@... wrote: Hello, I am new to flex and I make lot of mistakes by calling a method or field in an object which does not exist. But flex builder 3 doesn't seem to throw a compile error when I do this. In java it would be a quick compile error. Is there any flex builder setting I can set to give compile errors. Example var data:Dictionary = new Dictionary(); data.length //no compile error for this data[indexint] //no compile error Create your own typed objects if you want type checking: public clas YourClass { public var indexInt:int; public var length:int; } var yourClass:YourClass = newYourClass(); var foo:String = YourClass.foo; //compiler error I'm pretty sure Java wouldn't throw a compiler error if you add or access a previously nonexistent key to a Dictionary, either, since that's pretty much the point of a Dictionary in most languages, isn't it? -Amy
[flexcoders] Re: Highlighting a Chart Collumn?
--- In flexcoders@yahoogroups.com, jmerrill_2001 jason.merr...@... wrote: The files are generally named based on the example that you click on, ie styles would be in the styles package, etc. Yeah, I figured that much out, thanks. What I mean is, it still does not show how to target a particular collumn based on data and draw in just that collumn. Finding what I specifically need for this isn't that simple given these examples. Don't charts have a fillFunction? HTH; Amy
[flexcoders] Copy or enumerate a CSSStyleDeclaration? (Flex 3.4)
I have a custom class that extends Canvas. I'd like this class to have the default styles used by Canvas, plus my own default styles. So I want to get the Canvas CSSStyleDeclaration and copy its properties to a new CSSStyleDeclaration used by my own component (then add my own stuff). I can't see a way to walk through the CSSStyleDeclaration and copy its properties or to separate out the instance so I don't affect all Canvases in the project. Any ideas? Thanks; Amy
[flexcoders] Re: Copy or enumerate a CSSStyleDeclaration? (Flex 3.4)
--- In flexcoders@yahoogroups.com, droponrcll amyblankens...@... wrote: I have a custom class that extends Canvas. I'd like this class to have the default styles used by Canvas, plus my own default styles. So I want to get the Canvas CSSStyleDeclaration and copy its properties to a new CSSStyleDeclaration used by my own component (then add my own stuff). I can't see a way to walk through the CSSStyleDeclaration and copy its properties or to separate out the instance so I don't affect all Canvases in the project. Never mind. Found it in the code to CSSStyleDeclaration.
[flexcoders] Re: Apparent data value change in Advanced DataGrid
--- In flexcoders@yahoogroups.com, Tom McNeer tmcn...@... wrote: I have an Advanced DataGrid that uses a Grouping Collection created from flattened data in an array collection. The hierarchy is only two levels deep: the grouping level and a detail level. At the grouping level, I want to display a grouping label, plus information in four of the other eight columns. Two of the columns are summary items. The grouping label function returns correct values, as do the summary columns. The final two columns are populated by RendererProviders set to display at a depth of 1. One displays the Provider of a service. The other displays a Status. Both renderers are very simple and virtually identical: ?xml version=1.0 encoding=utf-8? mx:Box xmlns:mx=http://www.adobe.com/2006/mxml; mx:Label text={data.children[0].Provider} / /mx:Box ?xml version=1.0 encoding=utf-8? mx:Box xmlns:mx=http://www.adobe.com/2006/mxml; mx:Label text={data.children[0].ProcedureStatus} / /mx:Box Each pulls a value from the first child in the data object's array. Since the values for each child are identical for these pieces of data, grabbing them from the first child works. Here's the odd part: let's say the first grouping has the following values: GroupingLabel: Some string here. Children: Provider: MyProvider1 Status: Approved Description: Some different value Provider: MyProvider1 Status: Approved Description: Some other value And the second grouping has the following values: GroupingLabel: Another string Children: Provider: MyProvider 2 Status: Pending Description: Something else altogether The grouping label displays correctly when the underlying array collection is populated, as do the Provider and Status, all in the grouping row. However, when the first row is opened to show its children, the Status display changed to Pending -- but the Provider display remains correct. And other elements bound to the value of Provider detect the change (for example, to display an Edit button). Yet -- if I add the value of Status into the function that builds the GroupingLabel, the original, correct value is displayed there. Does anyone have any clue as to what's causing a change in the collection's data? Put a break point into a handler for the event when the row is opened, then look in the variables window to see if the data has actually changed. If it has, then you'll need to work backward from there to see how and why. My suspicion is that the data hasn't changed, but instead that for some reason the renderer you see when you open the row is one that has previously been used for another item. Since the data binding can't refresh on {data.children[0].ProcedureStatus} (if you're using Flex Builder, you should have seen a warning on this), you're seeing the value that was populated when the renderer was used before. Try using children.getItemAt(0) instead. HTH; Amy
[flexcoders] Re: What the heck am I doing wrong with my GroupingCollection?
--- In flexcoders@yahoogroups.com, vam6981 v...@... wrote: See if this example resolved your problem http://vam1021.webs.com/ADGPanel/ --- In flexcoders@yahoogroups.com, golnooshp golnooshp@ wrote: Hi Mark, Can you sort on groups at all? Because I know this is a bug in flex that you actually cannot sort on grouped data! the groups can only be sorted if the original data is a hierarchicalData and not a flatData! I'm having the same problem! my data is flat! and in my UI, user can add grouping to ADG, I want to make a custom sort function to be able to sort my groups! let me know if I underestood your question correctly and we are looking for the same thing! I posted this question on more than 10 websites! hopefully I'll get an answer soon and will share it with you! There's a Grouping demo at flexdiary.blogspot.com that shows sorting on dates. Maybe it will point you in the right direction. HTH; Amy
[flexcoders] Re: Apparent data value change in Advanced DataGrid
--- In flexcoders@yahoogroups.com, Tom McNeer tmcn...@... wrote: Amy, Thanks for the advice. I'm very new to the ADG, and as you well know, it has quirks. Put a break point into a handler for the event when the row is opened, then look in the variables window to see if the data has actually changed. If it has, then you'll need to work backward from there to see how and why. I've attempted to do this, creating a function first assigned to the itemOpening attribute of the ADG, then later to the itemOpen attribute. In neither case does the function appear to be called. There's a breakpoint, but it's never reached. Am I missing something? Nevertheless, I put a bogus button in place so I could fire an event that would let me look at things before and after the tree was opened. And things have gotten even weirder. Yes, the underlying data is changing. The Status is actually being changed within the array collection. Worse yet, it's being changed to a value that does not exist anywhere within the array collection. My test has two groups: in one set of grouped data, the Status is Approved; in the second, the Status is Denied, When I open the tree, the Status displays Pending. When I examine all the variables within the component before the tree is expanded, that string appears nowhere. Nowhere. So clearly, it's being injected from somewhere else. Not from the server, because Charles shows no activity. Something inside the app - but outside the component - is changing the array collection. In your example data, you _did_ have Pending in the second grouping. If your ADG is editable, the possibility is that your retained value is somehow triggering an edit on the wrong item. Until I can find that, I don't think anyone can help. But I appreciate the attempt. Did you try changing to getItemAt? If so, what was the result? -Amy
[flexcoders] Re: Editable Axis Titles - possible sizing and/or
--- In flexcoders@yahoogroups.com, mole5000.geo aardvark5...@... wrote: I have a strange bug with dropping in a new titleRenderer on a mx:AxisRendrerer. It's so strange I feel I must be making a conceptual mistake. Basically I've defined a new Component that contains a Label and TextInput, the idea being you click on the label and it turns into a TextInput to allow you to edit an axis's title. However, if I type in a 'long' string into the input (where long means you have to scroll the text to see all of it) when I try and switch back to the Label the axis renderer decides to regenerate the titleRenderer meaning I lose the changes made to the title. Simply making the text box bigger hasn't helped (and that's hackish workaround anyways), a similar amount of text (even though it does require scrolling to see) still triggers this regeneration. I can't help but feel I'm missing how titleRenderer's should work. Is this expected behaviour or have I got bugs in my code. Obviously, I could post code if this would help answer my question. I notice in the example here: http://www.virtualnomad.net/wp-content/uploads/editablecharts/editablecharts.html that he has the same problem I do, click on on an axis title, type in short text and it works, type in long text and it gets replaced with a new component (and it throws a NPE just to round things off, my code doesn't do that). Check out how the check box header renderer class works here http://www.benclinkinbeard.com/2007/11/efficient-reusable-and-centered-checkbox-renderers-for-datagrids/ . This may get you headed in the right direction. HTH; Amy
[flexcoders] Re: TileList and CustomItemRenderer: How to dynamically change styles
--- In flexcoders@yahoogroups.com, anuppc anu...@... wrote: Hi, I'm new to flex, would need some help from the experts. I have a TileList in my application.. Here is the snippet: var favList:TileList = new TileList(); favList.columnCount = 2; favList.dataProvider = favArr; favList.itemRenderer = createItemRenderer(); favList.percentHeight = 100; favList.percentWidth = 100; favList.dropEnabled = true; favList.dragEnabled = true; favList.dragMoveEnabled = true; The ItemRenderer tied to the TileList is : mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% borderStyle=solid borderThickness=0 cornerRadius=5 mx:Style .filled { border-style: solid; border-thickness: 0; border-skin: ClassReference(border.SimpleGradientBorder); fill-colors: #F0F0F0, #C9C9C9; corner-radius: 10; drop-shadow-enabled: true; } /mx:Style mx:Script ![CDATA[ public function changeStyleWest(col1:String, col2:String):void { box.setStyle(fillColors, [col1, col2]); } ]] /mx:Script mx:HBox id=box styleName=filled horizontalAlign=center verticalAlign=middle width=100% height=100% borderColor=#B7BABC borderStyle=solid borderThickness=0 cornerRadius=5 themeColor=#009DFF mx:VBox horizontalAlign=center verticalAlign=middle borderStyle=solid borderThickness=0 cornerRadius=5 mx:Image id=image width=100 height=100 source=assets/{data.Image} visible=true/ mx:Label text={data.Name} width=100 textAlign=center visible=true / /mx:VBox /mx:HBox /mx:VBox Now what i want to achieve is else where in the application there are couple of buttons and on clicking these buttons i want to change the fill-colors or style of each Tile based on some Data attributes. http://flexdiary.blogspot.com/2008/08/tilelist-with-stylefunction.html There's a more complete example of how to use it in the Grouping Function example. HTH; Amy
[flexcoders] Re: any good effects for initial loading of a datagrid with text?
--- In flexcoders@yahoogroups.com, luvfotography ygro...@... wrote: Hi are there any good effects for loading a datagrid with text? Like having the text float in from all directions? thanks, You could probably look at List and TileList and extend Datagrid to do something like this: http://www.adobe.com/livedocs/flex/3/html/createeffects_5.html HTH; Amy
[flexcoders] Re: FileReference.save optional
--- In flexcoders@yahoogroups.com, markdemich d...@... wrote: --- In flexcoders@yahoogroups.com, droponrcll amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, markdemich demi@ wrote: A lot of my customer base still uses Flash 9. Was trying to determine that if Flash 10 was loaded I would conditionally provide a feature in my app to save something to a file. I tried faking out the compiler by doing something like this. if (isFlash10) { var f:Object = new FileReference(); f.save(xyz,null); } but I get an error when I run it in Flash 10. Everything I found leads me to believe that I need to compile for Flash 10. However, I fear that will mess up my Flash 9 users. Does anyone have any advice on making a SWF that will work in 9, but optionally use Flash 10 features. Try/catch. Try/catch won't help since it doesn't work, period. Do you mean to tell me that if you attempt to instantiate a new FileReference, that try/catch won't allow you to determine that the attempt failed and do something based on that failure? Can you post your code that didn't work? -Amy
[flexcoders] Re: selecting a column in a datagrid
--- In flexcoders@yahoogroups.com, Felino p...@... wrote: Thanks. I was able to do as you suggest the function is like private function selectColumnAt(columnIndex:int):void { if (columnIndex 0) { if (_selectedColumnIndex != columnIndex) { deselectColumns(); var selectedColumn:DataGridColumn =this.columns[columnIndex]; selectedColumn.setStyle(backgroundColor, 0x7FCEFF); selectedColumn.setStyle(headerStyleName, selectedDataGridHeaderStyle); _selectedColumnIndex = columnIndex; } } } The only problem is that I can't change the background color of the column header. I have a style defined as .selectedDataGridHeaderStyle { fontWeight: bold; backgroundColor: red; background-color: blue; } The header text changes to bold but the background color doesn't change. Any ideas? Probably the column header class doesn't extend something that uses Halo Border. You'll need to add a halo border to the existing base class, extend something that uses it, or roll your own class that has its own backgroundColor style that you create. HTH; Amy
[flexcoders] Re: FileReference.save optional
--- In flexcoders@yahoogroups.com, markdemich d...@... wrote: A lot of my customer base still uses Flash 9. Was trying to determine that if Flash 10 was loaded I would conditionally provide a feature in my app to save something to a file. I tried faking out the compiler by doing something like this. if (isFlash10) { var f:Object = new FileReference(); f.save(xyz,null); } but I get an error when I run it in Flash 10. Everything I found leads me to believe that I need to compile for Flash 10. However, I fear that will mess up my Flash 9 users. Does anyone have any advice on making a SWF that will work in 9, but optionally use Flash 10 features. Try/catch.
[flexcoders] Re: How to resize image to fill area and clip
--- In flexcoders@yahoogroups.com, Greg Hess flexeff...@... wrote: Hi All, I have a content area that I need to fill with a user supplied graphic. The graphic may be any aspect ratio and I want to scale the image to the content area and maintain aspect ratio however, instead of producing white space where the aspect ratio could not be achieved(Standard behavior of the Image class) I would like to clip the image. The area will always be filled entirely, the aspect ratio will be maintained but the image may be clipped. Does anyone know how I can do this? Any help much appreciated. This is a snippet from Flash, not Flex, but it might point you in the right direction: var loader:Loader = Loader(e.target.loader); //measure the content var lw:int = loader.width; var lh:int = loader.height; var finishedWidth:int; var finishedHeight:int; /* Check to see which dimension of the image is closer to the same thumbnail dimension. We'll scale that one and crop the other. */ if ( Math.abs(thumbwidth - lw) Math.abs(thumbheight - lh) ) { //scale horizontally scaledX = true; trace ('scaled x'); } else { //scale vertically scaledX = false; trace('scaled y'); } scaleFactor = calculateScale(lw, lh, scaledX); trace('scalefactor', scaleFactor); //calculate what the dimensions will be after scale applied finishedWidth = Math.ceil(scaleFactor * lw); finishedHeight = Math.ceil(scaleFactor * lh); /* In most cases, that will work, but in some cases that gets it wrong. Check for this and fix it */ if (finishedWidth thumbwidth || finishedHeight thumbheight) { trace(scaleFactor * lw, scaleFactor * lh); scaleFactor = calculateScale(lw, lh, !scaledX); //recalculate finished dimensions finishedWidth = Math.ceil(scaleFactor * lw); finishedHeight = Math.ceil(scaleFactor * lh); } trace(loader.height*scaleFactor, loader.width*scaleFactor); var matrix:Matrix = new Matrix(); matrix.createBox(scaleFactor, scaleFactor); //make a scaled copy of the content var scaledBitmap:BitmapData = new BitmapData(finishedWidth, finishedHeight, false); scaledBitmap.draw(loader.content, matrix, null, null, null, true); //crop the bitmap //this is a slice out of the middle of the image var rect:Rectangle = new Rectangle(Math.floor((finishedWidth-thumbwidth)/2), Math.floor((finishedHeight-thumbheight)/2), Math.ceil((finishedWidth +thumbwidth)/2), Math.ceil((finishedHeight+thumbheight)/2)); trace(Math.floor((finishedWidth-thumbwidth)/2), Math.floor((finishedHeight-thumbheight)/2), Math.ceil((finishedWidth +thumbwidth)/2), Math.ceil((finishedHeight+thumbheight)/2)); trace('width', finishedWidth, 'height', finishedHeight); //move it into the corner var point:Point = new Point(Math.floor((finishedWidth-thumbwidth)/2)*-1, Math.floor((finishedHeight-thumbheight)/2) * -1); var croppedBitmap:BitmapData = new BitmapData(finishedWidth, finishedHeight, false); croppedBitmap.copyPixels(scaledBitmap, rect, point); var image:Bitmap = new Bitmap(croppedBitmap); addChild(image); imageLoadCount++; actualLoadCount++; image.x = (thumbwidth+10) * (actualLoadCount); image.y = 200; HTH; Amy
[flexcoders] Re: Lagging Panel title
--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: Possibly... override public function invalidateDisplayList():void { super.invalidateDisplayList(); _title = propertyObject.title + ' Properties'; } I think what's going on is that they put the logic for changing the display of the title text in commitProperties instead of updateDisplayList. Since my code was where it belonged in the commitProperties override--after their code, it didn't work. I just moved the logic into the setter, but I think I could have put it above their logic in commitProperties as well...
[flexcoders] Lagging Panel title
Hi, all; I have a component that extends Panel. The panel title is bound to a private bindable variable that I set in commitProperties. The title variable updates, but the titleTextField.text doesn't update, so the title always lags behind. I haven't done Flex on a regular basis in a few months, so if someone can see what I'm doing wrong here, I'd appreciate it: ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical xmlns:view=com.magnoliamultimedia.view.* title={_title} mx:states mx:State name=realObject mx:AddChild view:RealCourseObjectProperties width=100% height=100% id=realObjectProperties / /mx:AddChild /mx:State /mx:states mx:Script ![CDATA[ import com.magnoliamultimedia.vo.ContainerItem; import com.magnoliamultimedia.vo.PresentationContainer; import com.magnoliamultimedia.vo.RealCourseObject; private var _propertyObject:*; private var _propertyObjectChanged:Boolean; [Bindable] private var _title:String='Properties'; /** * Object whose properties we want to show. * Can be RealCourseObject, PresentationContainer, or ContainerObject */ public function get propertyObject():* { return _propertyObject; } public function set propertyObject(obj:*):void { if (!(obj is RealCourseObject) !(obj is PresentationContainer) !(obj is ContainerItem)) { throw new Error('propertyObject must be RealCourseObject, PresentationContainer, or ContainerItem.'); return; } if (obj != _propertyObject) { _propertyObject = obj; _propertyObjectChanged = true; invalidateProperties(); invalidateDisplayList(); } } override protected function commitProperties():void { super.commitProperties(); if (_propertyObjectChanged) { //change state to reflect what kind of object was selected if (propertyObject is RealCourseObject) { currentState = 'realObject'; realObjectProperties.realObject = propertyObject as RealCourseObject; } _title = propertyObject.title + ' Properties'; invalidateDisplayList(); _propertyObjectChanged=false; } } ]] /mx:Script /mx:Panel Thanks! Amy
[flexcoders] Re: ResultEvents
--- In flexcoders@yahoogroups.com, umberto pelliccia umberto_pellic...@... wrote: I have a class that extends a remoteobject and contains a function getClassinfo and a listener onResultGetClassInfo (event: ResultEvent), I'd like to check if the function was completed from another class ... how? Why not just set the AsyncToken object that the RemoteObject Operation returns to use an event handler in the class that needs the information? http://flexdiary.blogspot.com/2008/11/more-thoughts-on-remoting.html HTH; Amy
[flexcoders] Re: How to use XML file as dataProvider for s:List
--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote: You can use mx:XML source=myFile.xml . for compile time embedding or you can use HTTPService for run-time retrieval. You can also use URLLoader, which works the same locally or from a network.
[flexcoders] Re: Cannot select identical item in my tree component...
--- In flexcoders@yahoogroups.com, - - sailorse...@... wrote: Hi Alex, if I need both objects to be identical, how can I assign different UID? If I double click the object on the parent node, I enable a view to edit the object. The same object is found nested deeper in the tree, if I double click it, it must edit the same object on the parent branch. Create a wrapper object with a different UID that the tree sees that contains the same object. HTH; Amy
[flexcoders] Re: How to set Script time limit in Flex 2 (or 3)?
--- In flexcoders@yahoogroups.com, icykorpio [EMAIL PROTECTED] wrote: give ppl a real case, before i wrote a software which contain the swf by c++. and people can click button in flex to command c++ wrapper pop up a windows system file dialog. but if user doesn't choose a file in 15 seconds. flex consider the script time out! any thing through ExternalInterface all the same fate! Adobe really needs to change this bad idea. I use a different program to contain my swfs. What I do in situations like this is to send a call out to the main application that starts whatever process, but it isn't expecting any return. When the main application _has_ a return, it calls a callback in the file that then takes the return and does whatever with it. It may not be the most wonderful system in the world, but it works. -Amy
[flexcoders] htmlText in text that originates in XML
I have an XML file that looks like this: [!CDATA[ pageContent txt x=10 y=10 w=120 h=100 The quick brown fox jumped over the blazy/b kitten. /txt txt x=430 y=60 w=150 h=100The quick brown fox jumped over the stripey kitten./txt txt x=100 y=420 w=200 h=50The quick brown fox jumped over the rotten tomato./txt img x=10 y=60img.jpg/img swf x=430 y=160 w=200 h=200swf.swf/swf /pageContent ]] This XML is passed in through ExternalInterface, hence the CDATA tags. I have a repeater that displays all the objects described in the XML. However, I can't seem to get it to respect the b tag. I've tried wrapping the contents of that tag in CDATA, but all that gets me is CDATA on the screen. When I don't wrap it in CDATA, the entire XML tag appears as a result of this expression: contentItem.valueOf().toString(), rather than just the bit in the middle. Can anyone point me to something that tells me how you wrap html text in the XML file to make it actually work properly inside a textArea? TIA; Amy
[flexcoders] Re: htmlText in text that originates in XML
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: How much of that are you assigning to the htmlText property? That's what I am trying to figure out. I can't find anything in the XML properties or methods that gives me exactly the stuff between the beginning and ending tags and nothing else. valueOf() does it if there are no html tags in there, but so far I haven't found anything useful for this. Thanks! Amy
[flexcoders] Re: htmlText in text that originates in XML
--- In flexcoders@yahoogroups.com, droponrcll [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: How much of that are you assigning to the htmlText property? That's what I am trying to figure out. I can't find anything in the XML properties or methods that gives me exactly the stuff between the beginning and ending tags and nothing else. valueOf() does it if there are no html tags in there, but so far I haven't found anything useful for this. I forgot to mention. If the string contains this: txt x=10 y=10 w=120 h=300[!CDATA[[The quick brown fox jumped over the blazy/b kitten.]]/txt The XML node contains: txt x=10 y=10 w=120 h=300 [!CDATA[ The quick brown fox jumped over the blazy/b kitten. ]] /txt What you see on the screen is [!CDATA[ The quick brown fox jumped over the lazy kitten. ]] So it looks like when I use the XML() function on the string, it adds line breaks around the b tags, CDATA or not. And of course, I'd rather not see the CDATA tags either. Thanks! -Amy
[flexcoders] Re: OT: Netiquette Question
--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 24 Oct 2007, [EMAIL PROTECTED] wrote: ), is there anything you can do about that mammoth disclaimer of yours. Maybe you could look in the archives. Maybe I good. But Tom Chiverton long disclaimer doesn't return any results ;-). Perhaps it would help if at the bottom of it you at least added Please trim this disclaimer when replying to FlexCoders posts.
[flexcoders] OT: Netiquette Question
Hi all; There didn't seem to be anything in the FAQ about trimming, so I was wondering what the policy of this group is. I read this group by digest, and I actually appreciate being able to go back in the history of the conversation in-line and see what has already been said. However, many long conversations seem to wind up with a huge stack like this: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt At the bottom of them, and this consumes space to no useful end. It has gotten to the point that I hit the home key to go up to the table of contents at the top of each digest and click the link to the next message to skip over all this. So I ask: is there any kind of netiquette regulation about trimming this stuff off, or should I just accept it as a FlexCoders FOL? Thanks; Amy
[flexcoders] Re: OT: Netiquette Question
--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 24 Oct 2007, [EMAIL PROTECTED] wrote: So I ask: is there any kind of netiquette regulation about trimming this stuff off, or should I just accept it as a FlexCoders FOL? The general rule is to only quote what you need to make the context clear. This should be down 'bottom quote' style and/or inline if needed. OOI why do you use the digest ? If you don't want to read everything (who does !) why not filter messages into their own folder and have your mail client thread them so you can read back up/down the thread as you need ? I subscribe to multiple yahoo forums and find the Digest the easiest way to deal with all of the traffic. As long as we're making suggestions about how others use the forume ;- ), is there anything you can do about that mammoth disclaimer of yours. It usually dwarfs your actual posts. -Amy
[flexcoders] Custom Component not visible on stage
I have created a custom AS component DragObject based on Canvas. The idea is that ultimately users will be able to put whatever they want inside this ontainer and it will handle most of the code of drag and drop for them. However, when I put another (100 x 100) Canvas inside this component just to test it out, the width and height of my component are 0, so it doesn't show up on stage. I used the super() method in my constructor, so I expected my component to behave like a Canvas in that it should automatically be sized around its children. Here is the AS for my class: package elearning { import mx.containers.Canvas; public class DragObject extends Canvas { public function DragObject() { super(); } private var _desc:String = Untitled Draggable Object; public function get desc():String{ return _desc; } public function set desc(descTxt:String):void{ _desc=descTxt; } override public function toString():String{ return(DragObject + _desc); } } } Thanks!
Re: SPAM-LOW: [flexcoders] Custom Component not visible on stage
--- In flexcoders@yahoogroups.com, Jeffry Houser [EMAIL PROTECTED] wrote: I've had similar problems when creating AS3 components. Look into updateDisplayList. I believe you also have to make sure that your custom component has a width and height specified. You can always dig through the canvas code to figure out why that works, and use that info to figure out why yours doesn't. The component really needs to size itself around its children, so I need to find a way to do it without specifying a width and height. My class is extending Canvas, so it should be using all Canvas's methods already, right?
[flexcoders] History Management (Flex Builder 2 TFS + FB3 Beta)
I am trying to work my way through Flex Builder 2 TFS, and I'm on the History Management lesson. I installed FireFox and set it as the default browser so that history management would preview properly. The first thing Lesson 15 tells you to do (p. 356) is to run the Data Entry Application. Because the Data Entry application uses a TabNavigator, you are supposed to be able to use the browser's back button after switching to the other tab. When I do this, the back button is not enabled. I noticed there is no iframe in the page Flex Builder 3 Beta 2 Milestone 3 makes, and there is no history.swf in the bin directory. Is History Management just broken in this build? TIA; Amy
[flexcoders] Re: History Management (Flex Builder 2 TFS + FB3 Beta)
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: HistoryManagement was re-implemented in FB3. No IFrames or History.swf. Instead there are different templates for the HTML wrapper. That lesson may need upgrading for Flex 3 I guess the real question is, should I be able to expect that the previous button in FireFox would become enabled after I clicked a tab on a TabNavigator control to navigate to a different tab? Thanks; Amy
[flexcoders] Re: String concat in MXML (with using @Resource)
--- In flexcoders@yahoogroups.com, kramus0 [EMAIL PROTECTED] wrote: Hi all, I have a simple question regarding text values in mxml files. Is it possible to concat string values in a mxml text or label property? So something like this: mx:Label text='Value' + 'AnotherValue'/ I know that it doesn't work because it uses it as a hole string and the single strings are not concatenated at all. But it works if I use data binding instead mx:Label text={BoundValue} + {AnotherBoundValue}/ Are there any other possibilities for string concatenation? I even would like to know if there is any possibility to use string concatenation using the @Resource directive. Because here even data binding doesn't work and I don't want to use ResourceManager etc. just to add a simple colon to the resource string for instance. I suspect mx:Label text={BoundValue} + {AnotherBoundValue}/ would actually give you BoundValueVarContents + AnotherBoundValueVarContents on the screen (i.e. you'll see the plus on the screen). But for what you want, you may want to try: mx:Label text={'string 1 ' + 'string 2'}/ HTH; Amy
[flexcoders] Re: not kosher to call function from inline renderer?
--- In flexcoders@yahoogroups.com, Paul Hastings [EMAIL PROTECTED] wrote: Paul deCoursey wrote: The inline component doesn't have that method in scope. Try {this.parentDocumen t.blobToImage. ... spoke too soon. while this got rid of the complier error, that method's still not getting called ie breakpoints on it never get fired. any ideas? Is it possible to use the blobToImage when creating the datasource for the ItemRenderers so that you just pull that as a property from the objects in your ArrayCollection?
[flexcoders] Re: not kosher to call function from inline renderer?
--- In flexcoders@yahoogroups.com, Paul Hastings [EMAIL PROTECTED] wrote: droponrcll wrote: Is it possible to use the blobToImage when creating the datasource for the ItemRenderers so that you just pull that as a property from the objects in your ArrayCollection? not sure i'm following. I'm not sure where your sampleData.sampleImagery is coming from, but let's assume it is an ArrayCollection containing Value Objects that is generated when parsing XML. Let's call the value objects BlobImages. Your blobToImage function returns something that can be used directly as an image source, obviously. What I'm not clear on is if it is a format that can be stored. I would suspect it can, since it gets passed back out of your blobToImage function. So, if it can be stored, you could do something like this as you make each ImageBlob (assume i is your raw imageblob in a for each loop): var ib = new ImageBlob( i.imageWidth, i.imageHeight, blobToImage(i.thumbnial, i.imageHeight, i.imageWidth) ); tempArray.push(ib); then in your mxml code: mx:Component mx:Image height={data.data.imageHeight} width={data.data.imageWidth} source={data.data.imageBlob}/ /mx:Component Just a thought from a relative newbie... -Amy
[flexcoders] Re: Snippets in Flex?
--- In flexcoders@yahoogroups.com, realeyes_jun [EMAIL PROTECTED] wrote: Amy, I've done a bunch of research and demoing and currently I think that WST is best for snippets in MXML and AS. If you want a description and some screenshots: http://office.realeyesmedia.com/blogs/jun/?p=31 When I clicked on the link to WST in your post, I could not find any link that obviously led to download this thing. and the installation update http://office.realeyesmedia.com/blogs/jun/?p=59 This post seemed to assume that you know some sort of starting point or context, which I don't. Maybe it would be clearer with the download in hand. An interesting question...why can't they borrow the snippets code from Dreamweaver? -Amy
[flexcoders] Re: Site Launch
--- In flexcoders@yahoogroups.com, Giles Roadnight [EMAIL PROTECTED] wrote: Yeah, it loooks pretty nice (but why open in a popup which I HATE!) I helped work on this site which is a slightly different looking flex site as well: http://fashion.canon-europe.com/searchandcreate.html On 10/15/07, candysmate [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.com, Mike Krotscheck mkrotscheck@ wrote: Hey everyone- We here at Resource just launched a new site last Friday, built entirely in Flex. I figured some of you might get a kick out of it, since the designers really went out of their way to do something that's not just a datagrid and a few bindings. Hate to say it, guys, but neither of these sites launched during my attention span (with DSL). Hope you have really motivated visitors!
[flexcoders] Snippets in Flex?
Is there a way to create snippets in Flex for reuse? If I had a nickel for every time I typed width=100% height=100% I'd be nearly able to buy a cup of latte at Starbucks. The code completion does help a lot, but being able to store frequently used code bits for later use would help more! Thanks; Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I can sense your frustration, and the tone of your answers are trying my patience. There are a lot of variables here, and it is not my full time job to support you through this. I know you've spent lots of time on it and it can be a real pain in the butt to figure out some things in Flex, but please don't take it out on those of us who are trying to help. I'm trying to help as many people on this forum as I can so I generally don't have the capacity to remember all the details of your issues, and that will occasionally cause me to steer you in the wrong direction, since I can't see all of the hazards on the road ahead of you. Since my recommendation of not sizing the image to 100% didn't work, it is probably that there is some factor I didn't consider, but I am recommending best practices here, so what you take away will hopefully serve you on your next Flex task. I think I recall that you had swfs with sizes like 300x175. How big do you want them to show up in your component. At their true size or scaled down in some way? I think I also recall asking you to post a couple of the swfs so I can see what they look like. Please do so in your next response so I can try to get a better understanding of why sizing these swfs is not working as expected. There is always going to be a chance that you'll have to do something one-off, but I haven't seen enough evidence that we really have to do so. Also, if you have a sketch, screenshot or any other visual that can give me an idea of what your goal is that will help too. Did I post too large a download here? I can post something smaller if that is the issue. Thanks; Amy
[flexcoders] Re: Placement of Image within Image Control
Sorry it took me so long to respond to this. I thought everything had moved over to the other thread. You are welcome to file an ECR for alignment properties or styles, but keep in mind that in most people's use cases, you don't want to stretch the Image beyond the size of the bitmap so there might be some play in one dimension, but not the other. This is because most of the time, you want to use the layout rules instead of having things overlap. I would also recomment not filling available space with Image in your renderer either. I have submitted an ECR FR-APOLLO-00096. I thought that maintainAspectRation was designed to allow images to scale gracefully. I think that the root issue here is that there is a bug in the way Flex is deciding when to scale content. If I have scaleContent and maintainAspectRatio both set to true, I'd expect that the content would size itself within the available space regardless of whether the control is set to a percentage of the container size or not. However, that is not what happens, so you get giant content in small containers with scrollbars. I think if the feature worked as expected you would indeed be correct. I asked in the other thread that you post a couple of the swfs so I can look at them. I'm now thinking that the content in the swf is not aligned to topleft. I wish AVM1Movie had timeline APIs too, but like I said, the Player team chose not to implement interoperability between the two worlds. You would think they would then step up to the plate and provide examples that show a workaround to restore functionality that has been eliminated. -Amy
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, droponrcll [EMAIL PROTECTED] wrote: Sorry it took me so long to respond to this. I thought everything had moved over to the other thread. You are welcome to file an ECR for alignment properties or styles, but keep in mind that in most people's use cases, you don't want to stretch the Image beyond the size of the bitmap so there might be some play in one dimension, but not the other. This is because most of the time, you want to use the layout rules instead of having things overlap. I would also recomment not filling available space with Image in your renderer either. I have submitted an ECR FR-APOLLO-00096. ROFLMAO. My husband has been sitting over there laughing at me cussing a blue streak. I went back to Matt Chotin's example and saw that it worked regardless of the different image sizes, so I looked again at his code. In the Image tag I found this text: verticalAlign=bottom horizontalAlign=center So it appears these properties have existed since at least FB 2 but they are not documented and do not appear in code hinting. If this post helps one other person struggling with this issue, I feel this entire week or so I have spent wrestling with this problem will have been worth it. Thanks for your patience, Alex, and for being a good sport through all my frustration! -Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Don't forget, this is a free volunteer service, and not my real job. If it takes more than a few minutes, I usually have to work on it at night unless my day suddenly clears up. Anyway, I think I have it working and will try to respond in more detail soon. I suppose it is comforting that it was more than a few minute fix for you, too. :-) But I found that the Image tag does, in fact, have a verticalAlign and horizontalAlign property, which fixes the problem quite handily! :-) Thanks! Amy
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Plenty of other folks have had the same frustration in Flex so you're not alone. We'll close out the bug when it gets over here. It probably should have been filed against Flex SDK instead of Apollo. I have FB 3 because my company is on the Apollo Beta. I don't think we're part of anything that would give us access to the FB3 SDK bugbase. It seems it is just a doc bug, so it should be easy enough to fix :-) Thanks! -Amy
[flexcoders] Getting Index of item clicked in repeater
Say I have a repeater that essentially scatters instances of a custom component all over the screen. When a user clicks one of the instances, I don't really care what data is displayed in the component. What I need to know is what was the index of the one that was clicked within the component. I have found lots of examples that refer to event.target.getRepeaterItem(), but none that allow me to find out where in the repeater collection that item was found. I'm sure this is fairly simple, but I haven't been able to tease the answer out of the docs. Thanks in advance.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I can sense your frustration, and the tone of your answers are trying my patience. There are a lot of variables here, and it is not my full time job to support you through this. I know you've spent lots of time on it and it can be a real pain in the butt to figure out some things in Flex, but please don't take it out on those of us who are trying to help. I'm trying to help as many people on this forum as I can so I generally don't have the capacity to remember all the details of your issues, and that will occasionally cause me to steer you in the wrong direction, since I can't see all of the hazards on the road ahead of you. Fair enough. I apologize that my frustration came through as an attack on you. I am going completely nuts that something that ought to be so simple is turning out to be a total nightmare. Since my recommendation of not sizing the image to 100% didn't work, it is probably that there is some factor I didn't consider, but I am recommending best practices here, so what you take away will hopefully serve you on your next Flex task. I think I recall that you had swfs with sizes like 300x175. How big do you want them to show up in your component. At their true size or scaled down in some way? Actually, the problem is not with the swfs. They're all roughly the same size, so they don't jump all over the place like the images do. However, I applied the function to them as well, with the assumption that if they were going to be placed on a canvas they'd need to be repositioned manually, too. The images and swfs may be displayed at their true size or may be scaled down, all depending on their size relative to the container. I'd thought that Flex would handle this elegantly, but it seems that the way that the image control positions the content within it has defeated this elegance. I think I also recall asking you to post a couple of the swfs so I can see what they look like. Please do so in your next response so I can try to get a better understanding of why sizing these swfs is not working as expected. There is always going to be a chance that you'll have to do something one-off, but I haven't seen enough evidence that we really have to do so. Also, if you have a sketch, screenshot or any other visual that can give me an idea of what your goal is that will help too. I've posted the whole kit and caboodle to ftp://ftp.magnoliamultimedia.com/Thumbviewer. I've removed the suggested improvements that gave the scrollbars, so you can see it pretty much as it ought to work, except that the image jumps all over the place. If you imagine it with the image staying in one spot (and at this point I don't care if it is the top of the container or the bottom or the center), then you'll be able to picture the desired functionality. You'll need to use the enclosed exe to run it, as it is being passed the xml from an ExternalInterface call. I didn't include the compiled files for size reasons. Thanks! Amy
[flexcoders] Re: Getting Index of item clicked in repeater
--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: I have not done this recently that I can recall, but here are some suggestions. * If your data Provider is a collection, you can use getRepeaterItem() with collection.getItemIndex() * Look at the repeaterIndex and instanceIndex properties of UIComponent. Remember the click handler event object provides the target and currentTarget properties to reference the repeated UIObject * Use a custom component to repeat and set an index property on it using repeater.currentIndex I've already tried suggestion 3, and the index does not seem to bear any relation to what was clicked. For instance, I can click 3 different things and get back 2, and several other things and get back 4, but never do I get anything other than 2 or 4. I have not even been able to get the click event to fire on the repeater itself, so it seems that option 3 is most promising. However, the index valued that is stored isn't correct. using mx:Repeater id=allBlocks dataProvider={contentSource.children()} ac:ContentBlock contentItem={allBlocks.currentItem} rIndex={allBlocks.currentIndex} / /mx:Repeater Thanks; Amy
[flexcoders] Re: Getting Index of item clicked in repeater
--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Here is an example using getRepeaterItem() and getItemIndex() Tracy ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=initApp() mx:Script![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; [Bindable]private var _acDP:ArrayCollection; public function initApp():void { var oItem:Object; _acDP = new ArrayCollection(); oItem = {Album:The Lost Chord, Artist:The Moody Blues, Price:15.99, x:30, y:30 }; _acDP.addItem(oItem); oItem = {Album:Meddle, Artist:Pink Floyd, Price:17.99, x:170, y:60 }; _acDP.addItem(oItem); oItem = {Album:Trespass, Artist:Genesis, Price:18.99, x:220, y:100 }; _acDP.addItem(oItem); oItem = {Album:In the Wake of Poseidon, Artist:King Crimson, Price:18.99, x:170, y:140 }; _acDP.addItem(oItem); oItem = {Album:Journey to the Center of the Earth, Artist:rick Wakeman, Price:18.99, x:30, y:110 }; _acDP.addItem(oItem); }//initApp private function onClickItem(oEvent:Event):void { var oItem:Object = oEvent.currentTarget.getRepeaterItem(); var iIndex:int = _acDP.getItemIndex(oItem); lblIndex.text = String(iIndex); }//onClickItem ]]/mx:Script mx:Label text=Clicked Item Index: x=0 y=0 fontSize=14 fontWeight=bold / mx:Label id=lblIndex x=160 y=0 fontSize=14 fontWeight=bold color=red / mx:Repeater id=rp dataProvider={_acDP} mx:LinkButton label={rp.currentItem.Album} click=onClickItem (event) x={rp.currentItem.x} y={rp.currentItem.y} / /mx:Repeater /mx:Application Thanks. I'll see if I can get this to translate to my code.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I suggest your renderer look something like this. You'll see use of dataChange and how to center the image. I don't have a proxy example, but that's a good topic for a blog article someday... Can you post two image swfs that don't center correctly? I want to make sure those swfs are aligned to topleft otherwise this centering code won't work for you. mx:Canvas dataChange=mediaObject= data as MediaElement mx:Script private var _mediaObject:MediaElement; [Bindable(mediaObjectChanged)] public function get mediaObject():MediaElement { return _mediaObject; } public function set mediaObject(value:MediaElement):void { _mediaObject = value; dispatchEvent(new Event(mediaObjectChanged); } private function centerImage():void { img.x = (width - img.measuredWidth) / 2; img.y = ??? } /mx:Script mx:Image id=img source={mediaObject.imgSrc} complete=centerImage() / ... Let me see if I understand what is going on here... The dataChange event will only fire if the component is being used as an itemrenderer, otherwise, the mediaObject will be set in the usual way...? We're dispatching a mediaObjectChanged event here, and I'm not sure why. What is listening for it? Or is it just good practice in case something wants to listen for it? The last question I have is about repositioning the image. My understanding is that the problem is actually the position of the image within the 100% image control. So since the control is 100%, I'm not sure how it _could_ be repositioned. Or, are you saying not to set the image control to 100%? Thanks! Amy
[flexcoders] Getting Index of item clicked in repeater
Say I have a repeater that essentially scatters instances of a custom component all over the screen. When a user clicks one of the instances, I don't really care what data is displayed in the component. What I need to know is what was the index of the one that was clicked within the component. I have found lots of examples that refer to event.target.getRepeaterItem(), but none that allow me to find out where in the repeater collection that item was found. I'm sure this is fairly simple, but I haven't been able to tease the answer out of the docks. Thanks.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I suggest your renderer look something like this. You'll see use of dataChange and how to center the image. I don't have a proxy example, but that's a good topic for a blog article someday... Can you post two image swfs that don't center correctly? I want to make sure those swfs are aligned to topleft otherwise this centering code won't work for you. mx:Canvas dataChange=mediaObject= data as MediaElement mx:Script private var _mediaObject:MediaElement; [Bindable(mediaObjectChanged)] public function get mediaObject():MediaElement { return _mediaObject; } public function set mediaObject(value:MediaElement):void { _mediaObject = value; dispatchEvent(new Event(mediaObjectChanged); } private function centerImage():void { img.x = (width - img.measuredWidth) / 2; img.y = ??? } /mx:Script mx:Image id=img source={mediaObject.imgSrc} complete=centerImage() / ... I tried this, and it put the image pretty far away from the upper left corner. I'm guessing that this is because x and y are actually the top left corner and not the center, though the docs are unclear on this. However, even when I corrected it to this: private function centerMe(thing:SWFLoader):void{ thing.x = (width - thing.measuredWidth) / 2 - (thing.measuredWidth/2); thing.y = (height - thing.measuredHeight) / 2 - (thing.measuredHeight/2); } it still puts the image far enough away from the corner to require scroll bars. Any ideas? Thanks; Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, droponrcll [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: I suggest your renderer look something like this. You'll see use of dataChange and how to center the image. I don't have a proxy example, but that's a good topic for a blog article someday... Can you post two image swfs that don't center correctly? I want to make sure those swfs are aligned to topleft otherwise this centering code won't work for you. mx:Canvas dataChange=mediaObject= data as MediaElement mx:Script private var _mediaObject:MediaElement; [Bindable(mediaObjectChanged)] public function get mediaObject():MediaElement { return _mediaObject; } public function set mediaObject(value:MediaElement):void { _mediaObject = value; dispatchEvent(new Event(mediaObjectChanged); } private function centerImage():void { img.x = (width - img.measuredWidth) / 2; img.y = ??? } /mx:Script mx:Image id=img source={mediaObject.imgSrc} complete=centerImage() / ... I tried this, and it put the image pretty far away from the upper left corner. I'm guessing that this is because x and y are actually the top left corner and not the center, though the docs are unclear on this. However, even when I corrected it to this: private function centerMe(thing:SWFLoader):void{ thing.x = (width - thing.measuredWidth) / 2 - (thing.measuredWidth/2); thing.y = (height - thing.measuredHeight) / 2 - (thing.measuredHeight/2); } it still puts the image far enough away from the corner to require scroll bars. Any ideas? OK, it looks like at least part of the problem is that the image is no longer scaling down properly now it is in a canvas instead of a vbox and it is no longer asking to be 100%. Not sure which is the issue. So, my speculation is that neither math could possibly position the image/swfloader properly, since both the image and the swf are now larger than the canvas. Grrr.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: That is correct, medaiObject is the API for component time, and data is mapped to it when it is a renderer. You have to dispatch an event for binding {} to work. Use of [Bindable] without an event causes us to wrap the property in a getter/setter pair which would be redundant in your case. In the code I proposed, the image is not 100%. When you do that, the image is far bigger than the container, causing all sorts of nasty side effects, including scrollbars. I'm not a fan of making things really big when only a portion of it is 'filled'. I'm just a fan of things that work, regardless of whether they're 'correct' or not. Taking the 100% off of it means that the image doesn't shrink into the container properly. I think you should set scaleContent=false as well. How will that make things better? Even with scaleContent set to true, the content doesn't actually shrink the way it should. I suspect that there are some esoteric undocumented rules somewhere about when and how content actually scales, but so far the only thing trial and error has shown is that the image _has_ to be 100% or some percentage of the container in order for it to work. Thanks for staying with me on this. I am getting very frustrated.
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: The image content is always at the top-left of the Image. Based on scaleContent, the Image will scale the content or try to shrink itself down. There are no 9 choices, the image content fully fills the Image plus/or/minus extra space in order to maintain aspect ratio if requested. I've asked the image control to fill 100% of the available space. So if the image is not the same shape as the space, the image winds up in an odd spot. I know there are no 9 choices now, and I suspect you know a bit more about the Flex team's abilities than I do, but I would not consider it outside the range of what they are capable of to allow you to choose where the content will reside in the image control. Considering how much time and effort they've spent making other features user friendly, I'd think that this would be a good use of engineering time. After all, they've managed plenty of other controls that allow you to select top, middle, bottom, left, center, right alignment. It shouldn't be that big a deal to add it to the image control. You use the parent container's layout to further position the Image. The VBox wrapper is trying to react to the new measured sizes by adjusting the size and position of the Image and while it should just work, sounds like something is off there. I wouldn't think the VBox would be able to move the content inside the 100% image control, but clearly SOMETHING is moving it. Oddly, all the miniature images appear in the same spot in the thumbnail renderers. Possibly because there is only one main control that is being switched out, whereas each renderer has to present only one image. If the image content is a SWF you further complicate the problem because the SWF can resize itself, but the Image is only checking the size of the first frame. Are your SWFs well-behaved in that they appear centered in their stages and are aligned relative to the top-left and don't go into negative coordinates? It might require more code to deal with different stage alignments. I think all the swfs I've used for my prototype are the same or nearly the same size, so they don't have the same problems as the image control. BTW, why doesn't the AVM1 movie object have stop() and play() methods at a minimum? -Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I see, if mediaObject you want to be your public interface to when you use it as a component instead of a renderer, then I would set up my bindings based on mediaObject instead of data. I'd probably just use a dataChange=mediaObject = data as MediaElement in the top level instead of overriding the getter/setter. I don't know what this means. I haven't found any documentation that refers to this (and believe me I have spent literally hundreds of hours combing the Flex documentation). Could you point me to a reference so I can get more information? In a Canvas there are no layout rules so you can place things on top of each other and turn one or the other off and on with visibility. That's what I would do and I would also calculate the centering solution then as well. OK, bear with me as I go through this in pseudocode: on mediaObjectChange set img control to 100% measure content set img control from 100% to size of content determine where top left of img control needs to be for img to appear centered set x and y of img Yes? With the advent of Actionscript 3 and the goal of maximized performance, the Flash Player did not allow interoperability between FlashPlayer9/AS3 SWFs and the ActionScript in older SWFs. You can use localConnection, but that's about it. For those of you trying to integrate older swf content, it has become much harder to do. You can use a proxy AS2 swf to communicate to your older content. That way you only have to tweak the one proxy swf instead of rebuild all of your older content. Is there an example proxy swf available for download? You know, I just realized I probably can't stop these movies anyway, since they are nested and the designer forgot to put the stopAllClips() function in most of them. Oh, well. Thanks; Amy
[flexcoders] Placement of Image within Image Control
I have an Image control that is supposed to be centered in a VBox. The problem is that the image file itself may be of varying dimensions and aspect ratios. When the image is smaller than the image control it is in, it is always at the top left of the image control container, causing it to look off center. Are there any properties on the image control itself that say where to position the image within its container? Thanks.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Like I said, I'm trying to minimize my time per message and generally give short answers and leave out detail. Sounds like you're on your way and that's great. Normally, though I don't override data getter/setters in my renderers. I map the data to a type in commitProperties. But there are exceptions to every rule... Nevertheless, I am concerned you haven't fully absorbed the recipe and maybe looking at your code will shed some light on it for you and others as there are things you can't do in the setter override that you should only do in commitProperties or later and thus your current recipe may not be cloneable on your next renderer. mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100 height=120 horizontalAlign=center verticalAlign=middle horizontalScrollPolicy=off verticalScrollPolicy=off borderStyle=solid mx:Script ![CDATA[ import vo.MediaElement; [Bindable] private var _img:String; [Bindable] private var _swf:String; [Bindable] private var _caption:String; [Bindable] private var _data:Object; [Bindable] private var _mo:MediaElement; private var swfContent:MovieClip; private function init():void{ //movie.addEventListener(Event.INIT, swfLoadHandler); } private function swfLoadHandler(e:Event):void{ swfContent = e.target.content as MovieClip; swfContent.stop(); } override public function get data():Object{ return _data; } override public function set data(_me:Object):void{ _data = _me; this.mediaObject = _me as MediaElement; trace('media element set'); invalidateProperties(); } public function set mediaObject(me:MediaElement):void{ if (me.imgSrc != ''){ this.imgSrc = me.imgSrc; } if (me.swfSrc != ''){ this.swfSrc = me.swfSrc; } this.caption = me.caption; _mo = me; //invalidateProperties(); } public function get mediaObject():MediaElement{ return _mo; } public function set imgSrc(img:String):void{ _swf = ''; _img = img; this.currentState=; } public function get imgSrc():String{ return _img; } public function set swfSrc(swf:String):void{ _img = ''; _swf = swf; this.currentState=isSwf; } public function get swfSrc():String{ return _swf; } public function set caption(cstr:String):void{ _caption = cstr; } public function get caption():String{ return _caption; } ]] /mx:Script mx:VBox id=viewHolder horizontalAlign=center verticalAlign=middle height=100% width=100% mx:Image id=thumbImage maintainAspectRatio=true source={'images/'+_img} scaleContent=true height=95% width=95%/ /mx:VBox mx:Label id=theCaption width=100% text={_caption} textAlign=center/ mx:states mx:State name=isSwf enterState=init() mx:AddChild relativeTo={viewHolder} mx:SWFLoader id=movie source={'movies/'+_swf} maintainAspectRatio=true width=95% height=95% scaleContent=true / /mx:AddChild mx:RemoveChild target={thumbImage} / /mx:State /mx:states /mx:VBox
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Daniel Freiman [EMAIL PROTECTED] wrote: I think you're looking for the Image.content property (inherited from SWFLoader). See the livedocs: http://livedocs.adobe.com/flex/201/langref/mx/controls/Image.html. The content is a child of the Image component (a light oversimplification here), and you should be able to set the x and y coordinates of the content to accomplish what you want. If this doesn't work I'll look closer at my code to see how I did it. OK, let me see if I understand what you are saying: When the content of my image control changes, I capture that event and (somehow) reset the x and y of the content based on where it has wound up inside its bounding box to center it? I would be _very_ grateful if you would look this up for me, since I've spent _way_ too much time on what was supposed to be a quick prototype. Thanks.
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: This renderer is based on VBox which is a container and is a bit heavy. I'm guessing that since you are showing movies that there aren't too many of them, but if there were, you might eventually run into performance issues. Lean-and-mean renderers are almost always written in Actionscript. On my blog (blogs.adobe.com/aharui) I have some examples. This renderer also uses states w/o transitions just to switch between two views. Renderers get recycled as you scroll and the state switching could be expensive since add/remove is slower than changing the visible flag. Because you used a container and are using databinding to fill out the fields, you probably don't need to override the data setter at all because commitProperties is probably not needed (in fact, you didn't implement and override). You also probably do not have to implement a mapping to your value object. You'll save a few microseconds here and there by doing so, but may not be worth the effort. Thus, in its most reduced form, this renderer could look more like this (you might need some code for positioning and sizing): mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml width=100 height=120 horizontalScrollPolicy=off verticalScrollPolicy=off borderStyle=solid mx:Script ![CDATA[ private function swfLoadHandler(e:Event):void{ var swfContent:MoveClip = e.target.content as MovieClip; swfContent.stop(); }]] /mx:Script mx:Image id=thumbImage maintainAspectRatio=true source={'images/'+ data.img} scaleContent=true height=95% width=95% visible={data.img.length 0} x=? y=? / /mx:VBox mx:Label id=theCaption width=100% text={data.caption} textAlign=center/ mx:SWFLoader id=movie source={'movies/'+data.swf} maintainAspectRatio=true width=95% height=95% scaleContent=true visible={data.swf.length 0} / /mx:Canvas I'm using a mapping to my MediaElement object because that object is contained in the source ArrayCollection and is also used to drive the large image viewer. The stop action doesn't actually work on Flash 6 files, which these have to be because they also need to run in Authorware, which hasn't had an upgrade to its Flash Xtra in about 5 years and never will now. It doesn't seem that you can actually get older Flash movies to stop from Flex without adding functionality and recompiling. I have to say that it seems that silly things like effects have been made easy in Flex, yet serious things, like controlling older swfs easily, have been made seriously difficult. You also forget that part of the goal is to be able to use the component _not_ as an ItemRenderer, or as an ItemRenderer where it is being called from a Repeater component. So while you can just look at data directly, what then happens when you go to use it not as an itemrenderer? My understanding is if you set a component's visible property to false, it will still take up space on the screen as if it were visible, so I'm a bit unsure of what you're doing here. -Amy
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: All children are sized and positioned by their parent based on explicit or measured width/height. Images are extra tough because their size isn't known at first measure since the bits aren't fully loaded yet. Personally, I would just adjust its position when the complete' event fires, but I also would expect the Container to handle this automatically. However, I've recommended you use Canvas so then you will have to position manually. If you decide to stick with boxes, we can look into this in more detail. All I'd be positioning manually inside the canvas would be the image control itself, which doesn't help. The image is sliding all over the place within the image control as different images are loaded. Some at the top, some at the bottom, some at the left, some in the center, etc. Thanks.
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Mike Krotscheck [EMAIL PROTECTED] wrote: Have you tried scaleContent = true ? Yes.
[flexcoders] Re: Placement of Image within Image Control
--- In flexcoders@yahoogroups.com, Daniel Freiman [EMAIL PROTECTED] wrote: On inspection it looks like I did what Alex is talking about. I'm a little confused at the sliding image issue. In my experience the loaded images are placed in the top left corner of the Image control unless you explicitly do something else. Well, that is what it looked like at first, but what actually seems to happen is that the placement is quite arbitrary. The same image will always have the same placement, but two images of a similar size might have different placements. For instance if I have an image that is 300x100 and one that is 275x100, one of them will be at the top, the other at the bottom. I find myself mystified as to why the image control doesn't just have properties that let you specify where the content is. In Authorware, when you import an image there's a little grid that lets you choose one of 9 placements for the image relative to where you imported it. This is great when you're replacing imported content dynamically, because you can align it how you want. You should be able to fit the Image control to the loaded image perfectly by doing something like this: image.width = image.content.width; image.height = image.content.height; image.content.x = 0; image.content.y = 0; Could that potentially make the content rescale again, resulting in an endless loop? Thanks!
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I'm going to try to combine your other response as well. Yes, the repeater lets you dictate what the data items are and the same is true for item renderers. Normally, you plug a collection or array or xmllist into a List/Tree/DataGrid, etc and the items in that collection become the data properties in the renderers. The renderers job is to pull fields from the data object and stuff it into UI widgets in a renderer. I'm a codehead, and while I've given many talks about itemrenderers at MAX and other venues, it is an entire hour presentation and assumes you're up to speed on object oriented programming and actionscript, and trying to distill this topic into an email on FlexCoders is outside my time constraints right now. I generally respond to these emails while waiting for builds and regression tests to run, and give short answers when I know others on the forum can fill in the details. Sounds like you're hitting a pretty straightforward issue dealing with actionscript. If you post your code, I'll try to take a look at it on my next pass through this forum (as a true codehead, it is often easier for me to read code than your description). Also see some code I helped with in this forum yesterday with the subject DataGrid cell access question OK, thanks. I actually tracked it down that the issue was I changed the data type of the data override function to my own custom object type. The problem is not that I don't understand ActionScript, but that there are so many things to it that I can't keep them all in my head at once as I move forward. And the points at which AS interfaces with MXML make it difficult to understand (as someone new to Flex) where the issue is. To _you_ it might be obvious that your statement to invalidateproperties was self-explanatory, but to me the important part that you didn't mention was you need to override the data getters and setters to incorporate the desired behaviors. Since the getters and setters actually originated in the files you pointed me at, looking at them was only helpful to the extent that it let me know there _were_ getters and setters for data. The compiler is actually what told me I needed to add the override keyword ;-). So, while clearly this is somewhat an AS issue, it is also somewhat a communications issue, since I am guessing that even someone intimately familiar with AS who was not familiar with how renderers work in MXML and not familiar with the inheritance involved might not have followed you either. Not to be critical, just pointing out how this looks from the perspective of someone just picking up this tool. BTW, the stack overflow was caused by a circular reference I hadn't realized was in there. It's somewhat possible my amateurish earlier efforts might have succeeded without that, and I'd never have learned the proper way to override the data methods. Thanks! Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: There is a recommended pattern involving calling invalidateProperties() in the .data setter, overriding commitProperties() to handle distributing the data, and other component lifecycle methods. There is documentation on making custom item renderers, and you can look at the source code for mx.controls.listClasses.ListItemRenderer and mx.controls.TextInput and other mx.controls that are IListItemRenderers. The repeater object lets you specify what to use as the data for each itemrenderer. It seems to me that it would be much simpler if all controls that use itemrenderers would allow this rather than forcing people to write special code. I don't think the help on itemrenderers says much on this subject, other than that objects to be used as itemrenderers should support the Data property. -Amy
[flexcoders] Re: MultiPurpose ItemRenderer
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: There is a recommended pattern involving calling invalidateProperties() in the .data setter, overriding commitProperties() to handle distributing the data, and other component lifecycle methods. There is documentation on making custom item renderers, and you can look at the source code for mx.controls.listClasses.ListItemRenderer and mx.controls.TextInput and other mx.controls that are IListItemRenderers. I looked at the source for ListItemRenderer, and when I tried to do the same thing, I got 1024: Overriding a function that is not marked for override. When I added override, I got incompatible override. Clearly there is something here that I am missing. Please keep in mind that I am a Community Expert for Authorware, which means that for the past several years the people who have answered what questions I've had have been instructional designers first, codeheads second. So please try to imagine you are in front of a classroom of people who are relatively new to Flex and couch your answer in those terms. Thanks; Amy
[flexcoders] Element type mx:Lab must be followed by either attribute specifications,
I've tried to add my own namespace to allow me to insert my own components, a process I've done several times before, and I get the error: Element type mx:Lab must be followed by either attribute specifications, or /. I am using FB 3 Milestone 3. The full MXML for the file is this: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:v=views.* layout=absolute mx:Script ![CDATA[ import mx.collections.ArrayCollection; import vo.MediaElement; import mx.controls.Alert; private var images:XML= thumbviewer image imgSrc=img.jpg caption=An Image!/ movie swfSrc=swf.swf caption=A swf!/ /thumbviewer private var imgArray:Array =new Array(); private function parseViewer():void { var loop:int = 0; for each (var me:XML in images.children()){ imgArray.push(new MediaElement (me.imgSrc, me.swfSrc, me.caption)); } Alert.show(imgArray.length+ ' imgarray'); allImages = new ArrayCollection(imgArray); } [Bindable] private var allImages:ArrayCollection; ]] /mx:Script mx:VBox horizontalAlign=center verticalAlign=top horizontalCenter=0 v:LargeView id=fullsize imgSrc={allImages.getItemAt(0).imgSrc}a/ mx:Button label=Change view click=fullsize.swfSrc='movies/swf.swf'/ mx:Lab /mx:Application
[flexcoders] Re: Element type mx:Lab must be followed by either attribute specifications,
--- In flexcoders@yahoogroups.com, droponrcll [EMAIL PROTECTED] wrote: I've tried to add my own namespace to allow me to insert my own components, a process I've done several times before, and I get the error: Element type mx:Lab must be followed by either attribute specifications, or /. Nevermind. I found it. I had copied and pasted from a file with a persistent error that Flex kept throwing even when the line was blank, and I didn't get all the tags. -Amy
[flexcoders] MultiPurpose ItemRenderer
I'd like to be able to create a component I can use as an ItemRenderer or not. It already works _not_ as an ItemRenderer, but all my attempts to add support for the data property haven't worked. Things I've tried: 1) A creationComplete event that checks to see if data is an object of the right type, then sets the appropriate object to data. This throws a stack overflow error. 2) On the property getters, if the properties are null I set them to the correct properties of the data object. Since the information is being gotten from a bound control, this throws it into an endless loop. I'm suspecting this is a design pattern that has been solved before, but I am not seeing an answer for it. Can anyone point me in the right direction? Thanks.
[flexcoders] Using installed Flash component in Flex
If you have a Flash component installed, how do you go about using it in Flex and what is the syntax for using it? Thanks; Amy
[flexcoders] Flash Components in Flex
Is there any way to use a Flash component in Flex? If so, how do you make the installed components available to Flex? Thanks; Amy
[flexcoders] XSLT in Flex
I have two components I'd like to use in my Flex piece that were developed by two different companies. They both use essentially the same information, but they want it formatted in two different XML formats. My life would be a lot simpler if I could apply XSLT to the XML after it is loaded into Flex and simply transform it from one kind of XML to another. This Flex will be embedded into an ActiveX control in a different program, so there will be no server or browser involved. The XML will be fed in from that program, which will read it from the local hard drive. Thanks; Amy
[flexcoders] Re: A file found in a source-path must have the same package structure
--- In flexcoders@yahoogroups.com, flashcrow2000 [EMAIL PROTECTED] wrote: When i usually get this error, I delete the package name and I hit Ctrl+Space, and let Flex autocomplete with its correct value. It might be a problem with the Folder name. I presume you have a folder list of something like com/classes/Events (if no, you might consider using one) I tried that after reading your suggestion and FB replaced the old name with..itself. The error still exists on compile. I'm following the folder structure suggested in the book, which is more natural than cramming everything into a com folder (and saves on the typing). Presumably any third party components would be designed to go into a com folder and so would not conflict with somethimg more utilitarian created outside of it. Thanks; Amy
[flexcoders] A file found in a source-path must have the same package structure
Hi, all; I'm working through the tutorial in the Flex Builder 2 Training from the Source book, using Flex Builder 3 beta. I accidentally called my events folder Events, and now when I renamed it I get A file found in a source-path must have the same package structure 'Events', as the definition's package, 'events'. I have changed the package name to events from Events, and I've even tried deleting the file and recreating it from scratch, but I still get the error. I had similar problems when I accidentally set the transparency of an AIR app without turning off its SystemChrome. No matter WHAT I did to that file, I still got errors. Unfortunately, I don't remember the fix to that. If anyone could give me a suggestion or two, I'd appreciate it. Thanks
[flexcoders] Re: Flex 2 Training From the Source
--- In flexcoders@yahoogroups.com, Tony [EMAIL PROTECTED] wrote: Amy, This may be your place. Go for it! OK, first question: In Lesson 7 (p 162), we instantiate the PopupManager class from inside a component. Wouldn't that cause problems accessing it from other parts of the program, if you needed to? Or am I misunderstanding the singleton class issue? Second question: Later in Lesson 7 (p 172), we create an ArrayCollection just of categories and then another ArrayCollection of Products arranced under the key of the ID of the Category. Why are we not just adding a Products property to each Category and storing the Products in that? Maybe that's explained or corrected later, but that's as far as I've read. :-) Third question: It seems to me that all the looping in the logic described in my second question is necessary because of a glaring hole in E4X. Because all of the hype around E4X says it assumes that the order of the XML nodes is important, yet when you use the .. operator, you don't get back any information on where that node was found. Does that hole actually exist, or is it just a hole in the docs for Flex? If it does exist, has anyone extended E4X to fix this, and if so could I get a link? If not, is it even possible (is the E4X logic in a class that is extensible? OK, that last question was actually several questions, but maybe someone can answer them, or at least take a stab. Thanks; Amy
[flexcoders] Flex 2 Training From the Source
Is there a forum for discussing the examples in Flex 2 Training From the Source? I have some specific questions, but I don't want to clutter up this forum with stupid newbie questions. Thanks; Amy
[flexcoders] Re: AIR vs DLL vs. External code?
--- In flexcoders@yahoogroups.com, hank williams [EMAIL PROTECTED] wrote: On 8/25/07, Jeffry Houser [EMAIL PROTECTED] wrote: hank williams wrote: So in your mind, Adobe's goal of being cross platform should be abandoned since there is no way to do cross-platform COM? Would you find it acceptable if it allowed you to do Mac only desktop stuff or does windows only compatible == desktop software? I think Adobe should provide hooks that allow extension, for instance by Java. If it so happens that a third-party or homegrown extension *happens* not to be cross-platform, AIR itself will still be cross- platform. It shouldn't be Adobe's business to enforce that everything that could ever be used by AIR would have to be cross- platform. For example, both Authorware and Director (Adobe's desktop application building programs) are both cross-platform but allow extension via Xtras and other means. Not all of those Xtras are cross-platform, but developers still find them incredibly useful, either because they are only working on one platform or because they can work around the gap in some other way on the other platform. You cant really compare AIR to authorware and director. These were both very thinly deployed tools (compared to flash) Shouldn't we be comparing them to AIR in this case? I'd be willing to bet that AIR's deployment (at this stage) is very thinly deployed. Yes, AIR has Flash Player embedded, but AIR != Flash Actually, AIR uses special non publicly available pieces of the flash platform to make installing totally seamless. When you click on an AIR app to download, it it leverages this not publicly available stuff to download the AIR runtime in the background. So they are leveraging the presence of flash to facilitate the installation of the runtime. This is a *big* deal and feels very different from downloading an exe in explorer. If it's not a big deal for your apps you can, as I said, just use one of the many flash to exe projectors out there. Also, Director and Authorware cant really be compared to AIR because neither of them was based on a runtime separate from the application being installed on the users computer. Being a completely self contained download made it more appropriate to allow these tools to bring DLLs or Xtras with them. Anything can be bundled in a stand-alone download, but AIR apps are not exe's and are dependent on the AIR runtime. This is a critical architectural difference. I disagree. I am not certain how Director works, since I've never used it except to make movies that were then integrated into Authorware, but Authorware has the ability to either incorporate the runtime into the content file as a new exe or to provide it separately. The fact that the AIR team chose only one of these strategies is not compelling to me. I think they may eventually add additional layers of access to the system, but I doubt that they will ever go as far as you would like because the responsibility is too great for a browser connected tool. I wouldn't consider AIR a browser connected tool. It does have an embedded browser, but... The ability to integrate with the local system (Via an execute type command) is almost mandatory for non-connected applications. It sounds like you are saying that there is no market for AIR. Based on the general reaction from the developer community, I would have to disagree. Of course perhaps you are just trying to say that given that AIR's focus on occasionally connected applications, that there isnt such a need for access to DLLs and such. If so I would whole heartedly agree. At this time, it does not appear that AIR fits that market very well (nor are they targeting the market.. ) If you need to run DLLs / COM / etc... then AIR probably isn't a good choice. This is clearly true. IMO, it does not make sense for Adobe to continue to develop Director when AIR and Flash have the potential ability to replace it. Adobe has already stopped development on Director, and I can tell you they will never manage to convince Authorware users to pick up Director, regardless of its innate capabilities, because we believe its days are also numbered. However, for the replacement to happen, Adobe will have to add more capability to AIR. -Amy
[flexcoders] Re: AIR vs DLL vs. External code?
--- In flexcoders@yahoogroups.com, hank williams [EMAIL PROTECTED] wrote: So in your mind, Adobe's goal of being cross platform should be abandoned since there is no way to do cross-platform COM? Would you find it acceptable if it allowed you to do Mac only desktop stuff or does windows only compatible == desktop software? I think Adobe should provide hooks that allow extension, for instance by Java. If it so happens that a third-party or homegrown extension *happens* not to be cross-platform, AIR itself will still be cross- platform. It shouldn't be Adobe's business to enforce that everything that could ever be used by AIR would have to be cross- platform. For example, both Authorware and Director (Adobe's desktop application building programs) are both cross-platform but allow extension via Xtras and other means. Not all of those Xtras are cross-platform, but developers still find them incredibly useful, either because they are only working on one platform or because they can work around the gap in some other way on the other platform. -Amy