ActionScript 3.0 :: Textfield.getTextFormat() Does Not Return Correct Format For That Index?
May 17, 2011All I have in the fla is this code
Code:
stop();
var t; var f;
[code]....
All I have in the fla is this code
Code:
stop();
var t; var f;
[code]....
I have a problem with the getCharBoundaries method of a textField, it doesn't return the correct rectangle for me. To show the problem I put a long text in a textfield and highlighted the rectangle returned by getCharBoundaries for every second character. Here is my code:
[Code]...
I think it would be simplest to explain it like this:
[Code]...
I'm using addChild(new nmonster()) to populate an on stage MC from my Library.
Instead of specifying the Symbol, I want to add it using an Array reference, like addChild(new monsterArray[0]()). I've tried a number of variations, but AS3.0 is unforgiving.
I am trying to get the datefield populated in the correct format. I tried the formatter but that doesn't seem to work. I need it to be YYYY-mm-dd
View 3 RepliesI need to format a url passed to Facebook Sharer via AS3 using navigateToURL(new URLRequest(request), "_blank");. The url that is passed has a lot of strange characters. What is the best way to get the correct output?[URL]..
View 1 RepliesI am trying to get the datefield populated in the correct format. I tried the formatter but that doesn't seem to work.I need it to be YYYY-mm-dd
View 1 RepliesI have a slideshow (graphicsshow_mc) within a navigation menu (graphicsmenu_mc) - a movieclip nested in a movieclip. There are previous / next buttons inside the slideshow that work correctly.
Example: prev_btn02.addEventListener(MouseEvent.CLICK, navBack02);function navBack02(event:MouseEvent):void { gotoAndStop("deinonychus")}
The navigation menu acts like chapters for a DVD, and I want one button to always go to the beginning. I copied the other code, but need it modified to reflect that it appears in the parent.
[Code]...
I am trying to format my datagrid column to display the decimal value of the price of the item they have chosen to (2) decimal places. Currently the datagrid is displaying $10 instead of $10.00 & $10.4 for $10.40?
Code:
import mx.controls.*;
import fl.controls.dataGridClasses.*;
[code].....
I have some code that looks like this:
ActionScript Code:
level_btn.x = 50 + (i - 1) % 10 * 50;
It sets the x location of my level button. But this is in a for loop (that's what the 'i' is for.) I run it and everything works perfectly, as it should, not a single problem. Then I press the auto format button in the flash actionscript editor. (It's the button that adds all of the ; to the end of each line and other stuff)
Well that changes my code to this:
ActionScript Code:
level_btn.x = 50 + i - 1 % 10 * 50;
thinking it's done me a favour but it hasn't. It's got rid of the brackets so it won't do the maths functions in the correct order. I've tried adding more brackets in places and other stuff but I just don't know how to fix it. It's annoying because every time I press the auto format button I have to add the brackets in again.
I'm working on my website which is a portfolio site, to showcase my work I have a basic XML image gallery which does 1 of 3 things loads a large photo, goes to a frame with a video player, or goes to another frame with a gallery of web design or flash work i've done. when a thumb is clicked i trace the indexOf(event.target) of the thumbnail clicked (all thumbnails are placed into an array).
the problem is that for some reason randomly the index will not be found and return -1, but then other times it will find the correct index and work properly. i don't know what the inconstancy is thats causing this to occur
I've read many solutions on the board about displaying correctly your Flash emmbed site in way to fit the browser screen of your visitors. I've tryied also many suggestions, and I can't get it right. I need to have my work look like this site [URL] The main flash movie used is 1200 x 626. I've copied the index.html and adjust for [URL] The main flash movie used is 1200 x 600. As you can see, the result is different, the site doesn't fits the screen, and that's what is getting me crazy,
View 2 RepliesI got TypeError: Error #1088: The markup in the document following the root element must be well-formed. But the output of this string look correct to me.
<midifile>C:UsersXYZDesktopwhite_night_in_G.mp3</midifile>
<resolution>240</resolution>
<tick>77767</tick>
<ttrack>5</ttrack>
<tpatches>0</tpatches>
[Code]...
Is it possible to return the index of the first instance of a specified value within an array? Similar to:
Code:
var my_string = "string";
var index = my_string.indexOf("g");
/*Outputs:
1
*/
Basically, I have two arrays, each with 10 values (in slots 0-9 of the arrays). So I need to see if an array has a specified value in it, but then I have to see if the other array has a certain value in it, in the same spot as the first instance of what I search for in the first array.
I want to search an array to see if it contains a specific string, and then get the index of the result. For example, if I had:
array[0] = "dogs";
array[1] = "cats";
array[2] = "oranges";
I want to be able to search for "oran" and get 2 back.
I am trying to set the color of a tlf text. To do this I would use the textformat. But I get an error message.
my code
function setTextColor(txt:* ,col:int){ var tf:TextFormat = txt.getTextFormat(); tf.color = col txt.setTextFormat(tf); }
[code]....
I can't seem to get hitTest work on a textField, is that correct? Does this only work on movieclips?
View 3 RepliesI have two dynamic textfield and they are both within two movieclips because I have action to rotate , enlarge and move the related movieclip so that the text changed accordingly.
But there is problem like after I record the position after modification to database and retrieve them back to the flashpage. The position of the movieclips are changed or maybe it is the textfield's position within the movieclips are changed which I have no exact idea what happened.
So could any one who can give some suggesion how should I arrange the textfield within the movieclip and how to keep track of the right position after enlargement or rotations,etc then?
Isn't it I have to consider the relative position of the textfield to the movieclip at the beginning.
I have an Array which holds phrases. Now I want to be able to set the var: on my dynamic textfield to the correct phrase in the array. It works when I use tmp_txt.text = phrases['yes'].sText, but I want to set it directly on the textfield. Is this possible?// explanation:// phrases['yes'].sText returns JA which is swedish for YES
View 4 RepliesI have two dynamic textfield and they are both within two movieclips because I have action to rotate , enlarge and move the related movieclip so that the text changed accordingly. But there is problem like after I record the position after modification to database and retrieve them back to the flashpage. The position of the movieclips are changed or maybe it is the textfield's position within the movieclips are changed which I have no exact idea what happened.
So could any one who can give some suggesion how should I arrange the textfield within the movieclip and how to keep track of the right position after enlargement or rotations,etc then? Isn't it I have to consider the relative position of the textfield to the movieclip at the beginning. Becuase I have no exact idea how should it work.
I have an Array which holds phrases. Now I want to be able to set the var: on my dynamic textfield to the correct phrase in the array. It works when I use tmp_txt.text = phrases['yes'].sText, but I want to set it directly on the textfield.
// explanation:
// phrases['yes'].sText returns JA which is swedish for YES
I am unable to use getTextFormat on a TLFTextField. I keep getting the error TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.text::TLFTextField/getTextFormat() at Untitled_fla::MainTimeline/frame1() Here's my sample code import fl.text.TLFTextField;import flash.text.*;
[Code]...
I've got a Gridcolumn in a Datagrid (Spark). The Column's dataprovider is a Number value that gets updated via Binding.Now, without an item renderer the cell displays the correct values.If I set an item renderer, I can't access the values in this renderer.My renderer looks like this, so nothing really do here (for now) but to trace the value, but the value is always NaN.
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%" >[code].......
without the renderer, the column displays the correct values, so apparently the DefaultGridItemRenderer works fine.As requested, here is my Datagrid;
<s:DataGrid id="dataGrid" dataProvider="{_listItems}">
<s:columns>
<s:ArrayList>[code]..........
_listItems is an ArrayList with instances of a model class, which has (amongst others) a property called change of type Number.
I programmatically created a textfield and I added it to the stage. I placed the textfield close to a dropdown menu that expands when a user hovers over it. Whenever I hover over the drop down menu, some options are hidden because the textfield behaves as if it has a CSS z-index greater than the css z-index of the drop down menu.
I do not have access to the code that created the drop down menu. How do I make it so that my textfield is behind the drop down menu?
Notes the reason I can't programmatically access the dropdown is because I don't have access to the code of the main flash object, whcih is hosted by a 3rd party company. I'm building a plugin. The remote server looks for plugins on my computer and hooks it in.
Sample Code
package {
import flash.system.Capabilities;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
[Code]....
I'm new to ActionScript and I'm having trouble creating a navigational index for my company's catalog. I've created 6 dynamic TextFields on the stage, given each of them a unique instance name (one, two, three, etc.) and have assigned to each of them the same eventListener and pageJump function via AS. My intent is to allow a user to jump to a specific page by clicking on the corresponding TextField. My question is how do I tell the function which TextField has been clicked? Nothing I've tried has worked thus far. If there's
var navList:Array = new Array(one,two,three,four,five,six);
function setFieldParam():void {
var i:int = 0;
[code].....
The thing I want is like I will have a input text field for someone to type his email address, but after he presses the send button I want it to check that input field and see if there is the "@" and the "." symbol available in the field or no.
View 11 RepliesIs there a way to get the line index from a specific word in a textfield?
View 1 Repliesinhalt.restrict = "a-zA-Z0-9_\-?
inhalt.multiline = true;
inhalt.wordWrap = true;
in the first case i do not want the user be able to use the enter / return - key and in the second one i do not want him use it more then two ore three times. how can i manage this? i've serched with google but i do not find the right things,
I have a global textfield format which I want to make a local copy of within a function, so I can make small variations without changing the overall global format. The way I do it below is still a reference instead of a value, so the global format changes as well. How can I make a new format (local to the function) based of the global format? [code]
View 0 RepliesI am trying to format a textField like so:
[code]...
altough the color has changed according to the difference between the results of the first and the second trace the color did not actually change in the flash movie when played.the setTextFormat was replace with setting it directly since this did not even lead to a reported change of the textColor. the textfield is dynamically attached to a movie and is filled with text before i change the color.