How would you create a custom thumb for a Spark HSlider/VSlider control in Flex 4
Solution
You need to replace the default VSliderSkin first, because it defines the skinClass of the thumb Buttton inline, which will override any CSS you try to apply from a stylesheet. Once you replace the VSliderSkin with a duplicate that removes the skinClass="spark.skins.spark.VSliderThumbSkin" value, you can specify an alternative skinClass for the thumb in a CSS file.
Need a simple and easy to understand solution for creating a Shopping Cart in Flex. The app would allow to ADD to the cart and REMOVE from the cart. Also, the quantity should increment when an existing item has been added. Line totals should be calculated, and also a grand total for the cart.
Looking for the cleanest and most optimal way of doing this.
Solution
I'm not sure that this is the best solution or this solution is covering all your needs. But its a good point to start from.
I can made some customization and improvement of my code, if this will be needed.
To create a custom context menu in Flex 4, fetching the captions from an XML file.
Solution
Custom items in a context menu can be added the same way in Flex 4 as they are in Flex 3 - by declaring your own ContextMenuItem(s) and adding them to your context menu. The ContextMenuItem can be given a caption as well as an event listener. The captions can be fetched from an XML file using HTTPService.
I want a TextArea with a prompt string that displays when the TextArea first displays, automatically disappears when user clicks in the TextArea and reappears if the user clicks outside the TextArea without entering anything.
Solution
Create a custom MXML component as shown in the details.
I'm trying to get a random number between 1-3 to return non-repeating 3 times. There are 3 spaces and 3 variables that are to be placed and i need the order to be selected at random each time they are called. I'm thinking a non-repeating random number generator between the range of 1-3 would be best, however i do not know how to write a random number generator with a range included within itself.
Solution
This code takes a start and end value (both int) and generates an array. From there it shuffles the array into a random order and returns the shuffled array. This returned array can then be used in a simple for..loop for whatever you need without worrying about repeated values. Just make a call to the function each time you need a new series. This example could be modified to take an array of values instead of a start and end value.
An SWC library complied with Flex 3 SDK, being added to Flex 4 project and conflicts with Flex 4 namespaces. Similarly, legacy Flex 3 SWF file has to be used within Flex 4 application. Latter can be found in large/legacy applications.
Solution
Implement legacy code within separate Flex application, compile with Flex 3 SDK and embed into Flex 4 application.
I'm trying to get a random number between 1-3 to return non-repeating 3 times. There are 3 spaces and 3 variables that are to be placed and i need the order to be selected at random each time they are called. I'm thinking a non-repeating random number generator between the range of 1-3 would be best, however i do not know how to write a random number generator with a range included within itself.
Solution
This code takes a start and end value (both int) and generates an array. From there it shuffles the array into a random order and returns the shuffled array. This returned array can then be used in a simple for..loop for whatever you need without worrying about repeated values. Just make a call to the function each time you need a new series. This example could be modified to take an array of values instead of a start and end value.
What if you are creating an application that compile size matters and you want to use JSON strings to get data into your application. JSON stands for JavaScript object notation, it is a more condense data format then XML and is able to define different types of data not just Strings. You can use the Adobe Core Lib classes to parse this information but these classes add a little extra weight to your application and in some apps this isn't ok but there is another way.
Solution
Because JSON is just a subset of JavaScript objects ExternalInterface can just send these objects as Strings to JavaScript within your browser and the JavaScript interpreter will send an ActionScript Object back to you with the correct types. I have also noticed that this information is parsed faster and more reliably then the standard version but remember that this is only helps you with decoding. If you would like to create a JSON string from an Object you will have to use something else.