Flex :: Dynamically Add Words Of Text To A Container?
Jun 3, 2010
I have a scenario where I want to dynamically add words of text to a container so that it forms a paragraph of text which is wrapped neatly according to the size of the parent container. Each text element will have differing formatting, and will have differing user interaction options. For example, imagine the text " has just spoken out about ". Each word will be added to the container one at a time, at run time. The username in this case would be bold, and if clicked on will trigger an event. Same with the news article. The rest of the text is just plain text which, when clicked on, would do nothing.
Now, I'm using Flex 3 so I don't have access to the fancy new text formatting tools. I've implemented a solution where the words are plotted onto a canvas, but this means that the words are wrapped at a particular y position (an arbitrary value I've chosen). When the container is resized, the words still wrap at that position which leaves lots of space.I thought about adding each text element to an Array Collection and using this as a datasource for a Tile List, but Tile Lists don't support variable column widths (in my limited knowledge) so each word would use the same amount of space which isn't ideal. how I can plot words onto a container so that I can retain formatting, events and word wrapping at paragraph level, even if the container is resized?
View 1 Replies
Similar Posts:
Sep 21, 2011
I have a loop that goes through data from a book and displays it. The book is not consistent in it's layout so I am trying to display it in two different ways. First way(works fine) is to load the text from that section in to a panel and display it. The second way is to create a new panel (panel creates fine) and then add collapsable panels(nested) to that panel. Here is the code from the else loop.
else if (newPanel == false){
// simpleData is just for the title bar of the new panel
// otherwise the panel has no content
[Code]....
The error I get is: ReferenceError: Error #1069: Property panel4.4 not found on components.readTest and there is no default value.
I have tried setting the "name" property instead of the "id" property.
View 1 Replies
Mar 18, 2011
I want to dynamically add component in Container like Canvas(TileList constraints each child has the same size, GridList is poor in performance), for example
[Code]...
when I click the button, I hope add a component(whatever the component is, and maybe each component has different size), and if the total width of all added child is greater than myHolder, I hope the new child can begin in new line, and stretch the height of myHolder at the same time.(layout with custom code is better)
View 2 Replies
Feb 11, 2010
Is there an easy way to make a parent container (eg Group) resize when it's children resize?
Below is a little example app. When I put the 200x200 'food' in the 'stomach' the stomach & it's containing 100x100 'body' should resize to contain the food.
[URL]
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code]....
View 2 Replies
Mar 29, 2010
I am trying to increase the height of container with increase in the number of contents inside the container. Like in my case i m using tileList inside tabNavigator , when I put contents inside the tileList, the height of tileList does not increase beyond vertical height of the viewport. It puts scrollbar on the container. I want to increase the height of an flex container with increase in the contents and introduce scrollbar on the browser with increase in contents in the flex container.
View 3 Replies
Jul 2, 2011
In a Flex Mobile project I have a simple itemRenderer where I'm trying to create an "bubble" texting effect, similar to ichat or iphone (just so you get what im going for). But if the text is longer than the screen it runs off, rather than just going down a line.
If I set Group thats holding the rectangle(to create the bubble effect) and the label to 100% it works and keeps it from exceeding the list containers bounds, BUT the group is always at 100% and looks bad, I'm trying to keep the "bubble" JUST AROUND the text.
Anyway so, at the top of my itemRenderer I tried specifying:
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%">
And here's my layout I figured since msg_container has a width of 100% I was hoping bubble_lable_group would just not exceed that but...it doesnt...it just runs off. I tried setting a max width but that does not allow you to input percents. And just to say it 1 more time. I know if i set bubble_lable_group width to 100% it works, and keeps it from going off the edge, but then the rectangle "bubble" stretches all the way across and just looks bad.
<s:VGroup id="main_container" horizontalAlign="left" paddingBottom="10" paddingTop="10"
verticalAlign="top" width="100%">
[Code]....
View 1 Replies
Jan 31, 2010
so i search for keywords ofc, but...doing this isn't really my thing:input.text.indexOf("spam") != -1 && input.text.indexOf("more") ! -1 && ... etc
I'd like to make it some what like:input.text.indexOf(<database>) != -1
View 0 Replies
Dec 23, 2010
I have a viewstack container w/ 3 views: red, black, and blue. How can I completely hide the black & not include it?
[Code]...
View 2 Replies
Jan 13, 2012
I am creating an flex Air project,so mxml file will run. I have circles in one Big circle at one side and will be same on other side.
Now how to drag any circle from any Big circle to other side. Or it could be like any two container having circles, then how to drag and drop circle?
For one circle i am able to do drag and drop.But I want one Big circle on left hand side and one big circle on right hand side .And small circles with class names will be in these big circles.Now i want to drag and drop those small circles in big circles.Big cicles should not move. Even i have tried this code in actionscript
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
[Code].....
But in this i want big circles should not move and small circles should only be dragged.
View 1 Replies
Jan 27, 2011
I created a somewhat custom Spark button by doing the File > New > MXML skin and basing it on spark.components.button. The problem is that I need to add an extra text field to the button component and dynamically change that text...but of course, the property isn't recognized on a Spark Button.
Is there a simple way to add this field to my custom button skin & its property so it can be addressed? If not, is there a simple way to take what I've done and just extend the Spark Button? I can't seem to find any examples that show how to do it without writing it all up in ActionScript.
View 1 Replies
Jan 27, 2010
I'm currently working on a custom component which extends Canvas (let's call it SuperCanvas) ; it's basically a container that let you zoom & pan its contents. It would be too long to explain why, but I can't use scrollRect, so I was forced to declare a Canvas object (called innerCanvas)... inside my SuperCanvas (I know, not very nice =/) I would like to know if there's a proper way to "redirect" the creation of my component's children in this canvas.
[Code]...
View 1 Replies
Dec 18, 2011
My input text already has words in them. When i click on it, i want all the words to disappear. How do i do it?
View 3 Replies
May 12, 2010
How can I change color of text on certain words?My animation plays the text animation of THIS SALE IS RED HOT!!! I want RED HOT it to be red. It seems the array can be indexed in such a way to switch the color from Blue to Red.MY BANNER ADD
var myArray:Array = ["THIS","SALE","IS","RED HOT!!!",];
var tm:Timer = new Timer(500);
tm.addEventListener(TimerEvent.TIMER, countdown);[code]....
View 1 Replies
Jan 4, 2010
I'm making a project in which I have a input/output text box. I'm trying to restrict the words that are able to be said in the input box, but I can't seem to figure out how I'd do that. I'd think that I'd use .replace, and possibly an if function which tells it that if a word used does not equal the allowed words, to replace it with something such as ###.
View 2 Replies
Feb 2, 2009
I am creating a dynamic text box, defining it as html, and reading a text to it from xml file. is there a way for me to pick some words in the text and color it in a different color from the one defined when creating the text box?
View 2 Replies
Aug 19, 2011
I'm writing a preview site that will load SWFs/images from a URL into a preview pane. However, the primary problem I'm running into is actually loading these SWFs. It seems that the object/embed tags require width/height attributes. I will not know the exact size of these SWFs; in fact, I will know absolutely nothing about them.
What I'm asking is, what is the best way to load in these SWFs? Is there a library that exists to do this? Or do I need to do it myself?
View 2 Replies
Sep 19, 2010
Yes, another one of those pour souls attempting to escape the confines of AS2 and venturing into the AS3 world! I'm simply trying to dynamically add an image frame (imgframe) to the stage, sticking an image holder (imgholder) into the image frame mc and then loading an image into the image holder mc. Here's the code I've been using as a test, but it spits out errors saying that a term is undefined on "mainmask_mc.imgframe.addChild(imgholder);" code. I've tried changing it to various things, but nothing works.
[Code]...
View 7 Replies
Jun 19, 2009
Rather than typing out each child to add to a container mc, I wish to use a for loop to do so. However, in AS2, when adding an instance of an object, I could specify a unique name based on the current number of the loop. In AS3, I dont know how to even give the same object a unique name if multiple versions a re being pulled from the library to the Stage!
See this step of basic code:: and perhaps someone may have an obvious point to make about the differences of standard procedures, moving from AS2 to AS3::�
Code:
var container:MovieClip = new MovieClip();
var wing:MovieClip = new MovieClip();
addChild(container);
[Code]....
View 1 Replies
Mar 4, 2010
Is it possible to count the amount of words in a dynamic text field in flash 8?
View 2 Replies
Aug 4, 2009
I have a website template in which I am trying to change the header text words and menu text words to customize the template. How do I do this in Flash CS4?
View 4 Replies
Jul 18, 2010
I just need to display Numbers as well as in Words also in the Text field.
For example
99999 - NINETY NINE THOUSAND NINE HUNDRED AND NINETY NINE
for this i plan to use Array
like seperate the given numbers to array ([9][9][9][9][9])
then convert these number in words
View 1 Replies
May 1, 2011
I'm planning to make a game that gives players the choice to search a word when selecting a character, and if that word is found, they get to play as them. I don't even have a clue what, where and how I am gonna put the list in the game for something to search it. I'll try to give an example:
A user puts "horse" into the input field, presses the "Search" button, and Flash searches the word "horse" in a list of maybe 30 or so words. If it returns no results, a message says, "keyword not found". If it is found, a picture of a horse comes up in the character preview box.
View 4 Replies
Jan 9, 2011
I have a question about textfields and I'm wondering if it is possible to change text styles of single words or lines within a textfield with actionscript.I use an empty textfield and add my text to that field in actionscript with the following code:
myTfield.text = "insert text here"the text contains multiple lines and I want some of them to be bold, italic or a bigger font size. The reason why I am adding my text to my textfield this way is because I need the text in the textfield to change when some buttons are pressed. Text will be added or removed from the textfield if buttons are pressed by the user and the current way I'm changing the text is by simply re-using the code above with new text in it. (it makes the code quite long though, but I guess I'll have to deal with that)But because I'm adding text this way I am not sure how to change the style of different parts of the text.
On a related note, with CS5 there are now a number of options for textfields. There is TLF text and classic text. I've searched around for the differences but I don't find the awnsers very clear. What option should I use for my textfield if I want it to look sharp like the text I'm typing here (its just regular text, no headers or anything). Some options just give blurry text because of the anti-alias and some settings don't seem to change a thing. And at times embedding fonts looks nice but sometimes it makes it worse. There are so many options to choose from, but it is unclear what would work best for regular text. (my text won't animate, it does move with a scrollbar, but I only care about how it looks when the scrollbar is still)
View 2 Replies
Oct 16, 2010
The correct code to constrain movie clips to a container movie clip (or sprite or whatever) in the fashion I was looking for is this:
var picContainer:PicContainer = new PicContainer();
picContainer.x = stage.stageWidth / 2 - picContainer.width / 2;
picContainer.y = stage.stageHeight / 2 - picContainer.height / 2;
addChild(picContainer);
var totalPics:int = 17;
var pic:Pic = new Pic(); //make an instance just to get its width
[Code] .....
View 3 Replies
Mar 30, 2009
For practice i am making a 3d photo gallery, similar to tiltviewer or the tutorial recently posted on [URL]
Basically I dynamically add an array of just plain sample images (for now), to a MovieClip container which is then rotated in 3d space to give it that tilt viewer effect. The problem that I am having is that 3d rotations are performed around the registration point, which on my container is the upper left hand corner as opposed to the middle. Is there a quick way to change this? Messing with position so far has not helped fix my rotation.
View 2 Replies
Dec 17, 2004
How to make a container/Movie Clip dynamically resize such as the effect employed in this site (animations included): [URL]. Furthermore, is it possible to have images load from an XML file and contain the information needed to have the container/Movie Clip resize accordingly.
View 1 Replies
Nov 22, 2009
I'm trying to isolate words entered by the user into an "Input Text" (command). In a function that executes every time a key is pressed, I set a string, "newTxt", to the text entered.[code]This works fine; I'm able to check the string "newTxt". However, this checks the entire command rather than one word. When I replace line 2 with:[code]it freezes. In theory, it should add every letter until it reaches a space or ends, right? Could anyone find my mistake? Also, how would I go about checking for the second word (after a space)?
View 2 Replies
Aug 10, 2010
Is it possible to change part of the text in a dynamic text field using Actionscript? For example can I change the color of some words that are in the middle of a sentence?
View 5 Replies
Mar 22, 2007
Is it possible to find words and then pass them as variables from a text field?
For example if I have the following text inside a text field inside my flash file:
"Playing soccer is fun"
Is it possible to somehow get those individual words and make 4 different variables out of them ?
View 1 Replies
Nov 10, 2009
Is it possible to make dynamic text boxes display only full words from an xml feed? At the moment I have a selection of feeds that are supposed to run into each other, but if some of the text is longer than expected I get the first one or two characters of a word tagged on at the end. Is it possible to have the flash read whether it has character space left to display the next word in the xml?
I know it doesn't really recognise spaces etc and just pulls in the info within the node, but maybe there's a work-around if you want to do what I'm trying?
View 1 Replies