AS3: How to get the size of a dynamically created text field
I'm importing text from an XML file and lines of text to display in the text separated under the other fields. How can I set the value y of each text field following so that there is little space (40 pixels or more) in the field above, regardless of the length of the text? Here is my current code. Any help would be greatly appreciated.
var textArray:Array = new Array();
for (var i: int; i < myXML.TOPIC [0].) QUERY.length (); i++) {
var textField:TextField = new TextField();
textField.htmlText = myXML.TOPIC [0]. QUERY [i]. QUESTION;
textField.x = 100;
Here's my problem... I want the value of is based on the height of all the previous text fields that have been created
textField.y is 100 + (40 * i);.
textField.border = true;
textField.width = 800;
textField.textColor = 0 x 000000;
textField.multiline = true;
textField.wordWrap = true;
textField.selectable = false;
addChild (textField);
textArray.push (textField);
}
Separate the variable of the loop that you update in the loop to keep track of the current value of y. The current value of there would be updated to the previous value, the height of the textfield newest once it was filled with text.
Tags: Adobe Animate
Similar Questions
-
Get the ID of a dynamically created symbol library, inside another symbol.
Hello world
I'm trying to get the id of a dynamic created symbol library.
When you dynamically create the symbol directly on the stage (or the level of the composition), there is no problem.
But I can not function when you create the symbol inside another symbol.
A few examples using 'getChildSymbols()' and 'aSymbolInstances '.
// USING "getChildSymbols()" /////////////////////////////////////////////////////////////////////////
ON THE STAGE
var m_item = sym.createChildSymbol ("m_item", "Stage");
var symbolChildren = sym.getChildSymbols ();
console.log (symbolChildren [0] .getSymbolElement () .attr ('id')); / / ok eid_1391853893203
/ / Inside a SYMBOL OTHER
var m_item = sym.createChildSymbol ("m_item", sym.getSymbol("holder").getSymbolElement ());
var symbolChildren = sym.getSymbol("holder").getChildSymbols (); / / I use this maybe wrong?
console.log (symbolChildren.Length) / / returns 0 if can't ID is
' USE 'aSymbolInstances "".
ON THE STAGE
var m_item = sym.createChildSymbol ("m_item", "Stage");
console.log(sym.aSymbolInstances[0]); / / ok (I guess) x.fn.x.init [1] 0: #eid_1391854141436 div
/ / Inside a SYMBOL OTHER
var m_item = sym.createChildSymbol ("m_item", sym.getSymbol("holder").getSymbolElement ());
console.log (sym.getSymbol("holder").aSymbolInstances [0]); / / Error Javascript in the event handler. Type of event = element
In this post is written: "mySym.aSymbolInstances will give you a table containing all the 'names' when you create symbols"
Would be - this only works on the scene / composition level only and not inside a symbol?
The following methods to obtain the same are indeed possible, but I do not simply want to use them in this case:
(1) storing a reference to the symbol created in a table and call it later by index.
(2) giving the elements an ID manually on the creation and use of document.getElementById () thereafter.
I can't believe that this is not possible. I am probably missing something here.
Forgive me that I am a newbie using Adobe Edge!
I really hope that someone can help me here.Anyway, thnx in advance people!
Kind regards
Lester.
OK, I solved my problem by using the (simple) code below.
I guess that 'getChildSymbols()' and 'aSymbolInstances' only works on stage / level of the composition.Just thought I'd share this to everyone. Peace!
var m_item = sym.createChildSymbol ("m_item", sym.getSymbol("holder").getSymbolElement ());
$.each (sym.$("holder").children (), function (index, obj) {}
Console.log ($(sym.$("holder").) ([Index] Children()) .attr ('id'));
});
-
How to get the size of the loaded swf file?
final/public class main extends Sprite
{
public void main()
{
loaderInfo.addEventListener (Event.COMPLETE, _onLoadCompleted);
}
private void _onLoadCompleted(event: Event): void
{
var tw: int = stage.width;
var e: int = stage.height;
TSW var: int = stage.stageWidth;
tsh var: int = stage.stageHeight;}
}
Above is my project simple as3 in flex builder 3.
My screen resolution is 1920 * 1080, when debugging, the SWF is stretched to the full EI client area, but the stage.stageWidth is 500 and the stage.stageHeight is 375, stage.widht and stage.height are 0, who can tell me why and how to get the right size of the SWF, named the area size customer of EI in this situation?
Thank you very much!
The HTML wrapper can resize the SWF later, so wait a frame and recheck stageWidth/stageHeight.
Alex Harui
Flex SDK Developer
Adobe Systems Inc..
-
How to get the size of the buttons created by JavaFX?
The codes here:
ToggleButton tb1 = new ToggleButton("Minor"); System.out.println(tb1.getWidth()); System.out.println(tb1.getPrefWidth());
The result is:
0.0
-1.0
But in the swing.
JButton tb1 = new JButton("Minor"); System.out.println(tb1.getPrefferedSize().width);
The output is 109, which is I want to get.
How can we get the size of the button created by 'new Button()... '. "as in Swing? I strongly hope that the answer is Yes, because I find very useful this function in the swing.
Thank you
(Note: I discovered that, after the "primaryStage.show ()" code, we can get the width of the button by using button.getWidth (), but when we use button.getPrefWidth () we get always - 1.0, the value considered as junk.)
For the object in the scene, I used to use "scene snapScene = new scene (root, 700, 500);" for example, if the result of "System.out.println (root.getWidth ()); "of course is 700,
So do not...
It gives me 47.0:
final Button button = new Button("Play"); final Scene snapScene = new Scene(button); snapScene.snapshot(null); System.out.println(button.getWidth());
As jsmith suggests however, you shouldn't really need to do. If you really need manage available according to the actual width of a button, something to link to the widthProperty.
-
How to get the size of the Applet in my form?
I am in the form of Oracle 11 g, I want to focus my use of the window the code below:
This works for 6i, but does not not for 11g. Asv_app_width := TO_NUMBER(GET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,WIDTH)); v_app_height := TO_NUMBER(GET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,HEIGHT)); v_win_width := TO_NUMBER(GET_WINDOW_PROPERTY(p_window_name,WIDTH)); v_win_height := TO_NUMBER(GET_WINDOW_PROPERTY(p_window_name,HEIGHT)); -- message("width" ||v_app_width); SET_WINDOW_PROPERTY(p_window_name,POSITION,(v_app_width- v_win_width) / 2,(v_app_height - v_offset - v_win_height) / 2);
Returns the value 0.GET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,WIDTH)
But once this line of message without comment, the next shape call this procedure of Center window works fine.
My problem is similar to this: http://www.orafaq.com/forum/t/149809/2/ but there is no solution.
I also found this: http://docs.oracle.com/cd/B14099_19/winitan.1012/relnotes.1012/relnotes/forms.htm
[Edited 3/12 16:50] Today, I found this code does not work for my first form (login form) when the application is launched. After login, the forms of rest can be focused very well. Don't know what is the reason.5.1.4.1 GET_WINDOW_PROPERTY Returns 0 on Microsoft Windows GET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,WINDOW_HANDLE) returns zero even with separateframe=true. Oracle Forms Online Help states that this should work on windows platform. This is incorrect as this Built-in does not support MDI.
So, if this does not work, how can I get the size of the applet and focus my window?
Published by: frank1018 on March 12, 2013 16:53If you want to Center your window when MDI is enlarged...
first create timer... under a time-new-forms-example...
Declare timer_id Timer ;Begin timer_id := Create_Timer( 'laf_timer', 50, NO_REPEAT ) ;end ;
Use this solution in what timeout... because it will not perform this procedure at a time new forms instance or preform triggers...
declare mh number; rh number; mw number; rw number;begin If lower(Get_Application_Property( TIMER_NAME )) = 'laf_timer' Then mh := get_window_property(forms_mdi_window,height); mw := get_window_property(forms_mdi_window,width); rh := get_window_property('yourwindowname',height); rw := get_window_property('yourwindowname',width); set_window_property('yourwindowname',position,(mw/2)-(rw/2),0); /* i make 0 for the value of Y.. for i liked it on the top but you can change it too */ end if; end ;
Published by: ck on 14 March 2013 02:44
-
How to get the size of the binary cache from code
Is there a way to get the size of the cache in bytes? (size() method retrieves the number of objects, as when the size of the cache is limited in configuration by unit-calculator 'BINARY')?Hey Meir,
As Wei said that there is a JMX exposed for each cache bean and you can just summarize the units attribute. There is a second attribute called UnitFactor that you also use to be precise. In most cases, UnitFactor will be 1 but the appropriate calculation of size in bytes of a cache is
Units * UnitFactor
Second, you ask this cache across all members of storage and summarize the results. This will give you then the size that includes the key and value but not take account of all sizes to index.
An easy way to make JMX requests within the coherence is:
String cacheName = ""; MBeanServer mbs = MBeanHelper.findMBeanServer(); Set
names = mbsc.queryNames(new ObjectName("Coherence:type=Cache,service=*,name=" + cacheName + ",*"), null); long totalUnits = 0; for (ObjectName name : names) { Integer units = (Integer) mbs.getAttribute(name, "Units"); Integer unitFactor = (Integer) mbs.getAttribute(name, "UnitFactor"); totalUnits += (units * unitFactor); } System.out.println("Total Units = " + totalUnits); There are other ways to get the size too.
You could write an aggregator that calls BinaryMemoryCalculator.INSTANCE.calculateUnits with the binary key and the value of each entry that went. This would not be very effective, but would be useful if you want to calculate the size of a subset filtered registration.
You could write a remained that gets the support of the cache card you want, cast to LocalCache and then call the appropriate methods to get unitfactor and units. You must run this invoked on each Member of storage.JK
-
How to: Extract the first three characters of a text field
Greetings-
What is the best method to extract the first three letters of a text field?
I need to extract the first three letters of a text field (surname in this case),
so I add other components to create an identification number for
a person.
This identification number which must be created consists of the
date of the person by birth, last 4 digits of social security number and
the first three letters of the person's first name.
Example:
== > Date of birth: 15/11/45
== > Last 4 SSN: 6654
== > Name: Smith
Identification number would be:
== > 1115456654SMI
Leonard B
That should do the trick:
I put your values in the variable, simply replace the names, according to the needs
This removes all the string of the / your birthday (if it's a string!) and puts it in the variable id:
It takes the 4 last letters/digits of your social security number string and adds it to the id:
It takes the first thre letters/numbers from your last name variable, capitalizes and adds to the identification string
It will be useful.
-
How to get the size of the screen in QML?
Is there a way to get the width and height of the current screen in QML?
Because I have to use absolute layout and I want to also leave the post of controller could correspond with the other dimension of the screens, I intend to calculate the position based on the size of the screen to locate the controller to a relative position. BB7 development, he is available to do this way. But I have not found how to do it in BB10 QML.
Thanks that someone can understand.
This might help
https://developer.BlackBerry.com/Cascades/reference/bb__device__displayinfo.html
-
How to get the size of physical layer DAQmx
Hi all
Description of the problem: I use the physical channel DAQmx as control. I selected a few channels of the browse option. Now, I want to get the number of channels selected from the list.
I checked the extent of I / O-> OR-DAQmx. But couldn't find
Is it possible?
I guess that the easiest way is to unflatten in an array first:
-
How to get the user input to dynamic Action confirmation message?
Hi guys,.
I use apex 4.1.
I added a page dynamic Action confirmation message box. How can I get the user input to the confirmation pop up?
Thank youHello
you do not directly get user input. But you should still be able to get what you want. Suppose you have a dynamic action which fires for a 'change' (or other) and who has two or more actions
(1) confirm
(2) execute the PL/SQL CodeIf the user clicks Cancel/no in the confirm dialog box, APEX stops execution of this dynamic action and not run "run the Code in PL/SQL.
Hope that helps
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
How to calculate the difference between two numbers in text fields
Hello, I am fairly new to this, and I am certain that I will be bothered by the simple answer is
I do a simple calculation... total of total assets - liabilities = net worth
I have my total assets and my total work of the liability, but is not a subtraction option in the properties of a text field for the Net of a field value.
I don't know... not any script Java can any who help out me?
Thank you
Judy
You can use the option of simplified field notation, but first your input fields names must be changed so that they do not contain spaces or punctuation. For example:
TotalAssets - TotalLiabilities
If you want to use JavaScript, what will be needed if you ever in more complicated calculations, you can use something like the following as the custom fields (net value) calculation script:
(function () {}
Get the values of the field as numbers
var v1 = + getField("total_assets").value;
var v2 = + getField("total_liabilities").value;
calculate the value of this field
Event.Value = v1 - v2;
})();
There are no restrictions on domain names when using JavaScript.
-
How to make the first letter in a capitalized text field
Is it possible for me to make the first letter of a capital of field if the user forgets to make capital? For example, in my form there is a field for the first name. I would like to enter into some type of Java script, so when the user off the field and the first letter tabs is not crucial, it will make capital. If I don't have to use Java Script, that will be fine too.
Hello
If it's just a word value, you can use this in the event exist;
this.rawValue
= util.printx (">?")<>
This changes the first character (represented by the?) uppercase (represented by the >) and all the characters of tail (represented by the *) lowercase (represented by the)<>
If you wanted something more general... If they could also enter a middle name, then you can call a function such as;
function
toTitleCase (textValue)
{
return
() textValue.toLowerCase replace (/ \b [a - z] / g, function replace (match) {return match.toUpperCase () ;});})
}
This example uses a regular expression to change all lowercase letters, following a word uppercase boundary.
Bruce
-
How to get the HTML for a button created in Muse
I am trying to create buttons in Muse and then share the HTML for these buttons with a developer. How can I do this?
Hello
You can export the HTML code for the Muse Site via the "Export as HTML" option in the file menu.
It will be useful,
Sonam
-
How to get the value of a dynamic checkbox?
Hello
I created a report with the following region.
I have a button that include the selected employees. I wrote the following code, but when I pressed the button it gives the error "the requested page is not found.".SELECT apex_item.checkbox(1,employee_id) " ", employee_name, status FROM employee WHERE parent_id IN ( SELECT employee_id FROM employee WHERE username=lower(:APP_USER))
The problem with the code above, because when I write another process to this button, it works. Thanks for the replies.BEGIN FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP UPDATE employee SET selected = 'Y' WHERE employee_id = to_number(APEX_APPLICATION.G_F01(i)); END LOOP; COMMIT; END;
Hello
Problem was that column type is "simple check box", even, you have used APEX_ITEM to generate.
Column type must be "standard report column.Now the page gives no error "the requested page is not found." When you submit the page, and a checkbox is checked.
In apex.oracle.com process crashes now table emp having no column TICKED.Kind regards
Jari -
How to count the occurrences of a column of text fields
Guys good day.
Could someone please help me with this writing javascript.
I want to be able to create a form where you type the items in the list of items and items gets compiled into the shopping cart as indicated in the picture.
So if someone could guide me with the javascript, it would be really useful!
Thank you guys
Something like this should do it:
var items = ["Apple", "Apple", "Apple", "Orange", "Orange", "Mango", "Apple"]; var cart = []; for (var i in items) { var found = false; for (var j in cart) { if (cart[j].name==items[i]) { cart[j].counter++; found = true; break; } } if (!found) { cart.push({name: items[i], counter: 1}); } } for (var i in cart) { console.println(cart[i].name+":"+cart[i].counter); }
Maybe you are looking for
-
I tried following the advice offered in the different threads bit I found on this but nothing works out. I want the cursor to be in the address bar when I open a new window or when firefox opens without restoring a previous session. I solved the prob
-
old apple for purchase 2008 id?
I bought Jakob Dylan in 2008 when it came out. Now iTunes it won't play if I connect with an Apple ID, I have not used for several years. God knows what this old password it. I can listen to the entire CD on for you, but not being able to play my pla
-
I was using my C50 Satellite to run a drive on an external DVD drive.The button stop began to Flash for a few seconds then the laptop cut out completely. I can't restart. It seems there is no power (no lights showing). I tried to remove the battery a
-
Wireless connections is lost after count is inactive.
My internet connection seems to be time. After that my counter top has sat idle for about 15 minutes my wireless connection is lost. I have to click on connect and wait until I can get online. I spent a lot of time on the phone with Frontier trying t
-
HP Z400 there a standard ATX PSU or an owner?
I have a HP Z400 with a bad processor and I want some parts for other computers. I wonder if the power supply is a standard ATX power supply? It has a taken 24pin. But I noticed that the pins 12 and 23 are yellow instead of orange and red by the ATX