Access cellRenderer textField in comboBox in AS3
Just getting up to speed in AS3 now and I am having problems
skinning a custom comboBox component.
I have created all the custom skins for my component and
added a custom font but the font is not centering itself correctly
in the dropdown list at runtime (its about 1 or 2 pixels off in the
y). I cannot seem to find a way to adjust the y position of the
text in the dropdown list. I can use:
my_c.dropdown.setRendererStyle("textPadding",2);
...but all that does is adjust the indent (x) value of the
text.
And adding the align property to my custom textFormat for the
dropdown only aligns it in the horizontal space as well.
How the heck to I adjust the vertical align in the cellRender
in the dropdown list!?
Any help is greatly appreciated.
I found a solution for this issue, but i don't know wether this is a perfect method or not, but it's working fine.
solution: -
create a simple button and place a dynamic text field and skip the instant name for this field. you can access this dynamic text by index number.
but if you have any visual effects on mouse overs then you need to assign the button label to all those stages in as3.
code:
//-----mous Up ----
var samplebtn_doc:DisplayObjectContainer = samplebtn.upState as DisplayObjectContainer;
var labelsamplebtn:TextField = samplebtn_doc.getChildAt(1) as TextField;
labelsamplebtn.text = "new button label";
//-----mous Over ----
var samplebtn_over:DisplayObjectContainer = samplebtn.overState as DisplayObjectContainer;
var labelsamplebtn_over:TextField = samplebtn_over.getChildAt(1) as TextField;
labelsamplebtn_over.text = "new button label";
//-----mous Down ----
var samplebtn_down:DisplayObjectContainer = samplebtn.downState as DisplayObjectContainer;
var labelsamplebtn_down:TextField = samplebtn_down.getChildAt(1) as TextField;
labelsamplebtn_down.text = "new button label";
Similar Messages
-
Access input textfield from stage to my AS3 file
I have an input textfield on my stage.
I have created a AS3 Document as the Main Class for my work.
Now I need to access the user input in the textfield and work with it in my class.
What's the quickest way ?When you do this:
private var prefiksi:String = prefix.text;
"prefix" is not yet accessible because your class is not yet added to the display list. Besides if it's an input text field no point in assigning to a var like that as the input field text will change as the user inputs his/her own text into it. You'd better assign it to a var when you need to process the input text.
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
Using target to get access to textfield
I'm struggling trying to get the correct (assuming it's possible) syntax to get access to a textfield in a movieclip via a button also in the movieclip.
Here's the specifics:
var statue:MovieClip = new mcStatue;
In mcStatue is a button: btnStatue, and a textfield named Qty.
On a mouse click to the button I want to be able to add to the Qty textfield.
e.target.Qty.text = "x"
game me: Property Qty not found on fl.controls.Button and there is no default value.
Is there a way to do this, or do I need to go after some kind of workaround?if you used:
statue.btnStatue.addEventListener(etc..);
then use:
e.currentTarget.parent.Qty.text="x";
p.s. you may need to cast e.currentTarget.parent as a movieclip: MovieClip(e.currentTarget.parent).Qty.text="x"; -
Access Present Textfield value in Help Text
Hi
I have a Text item and I wanted to access the Value of that text item in the text field property "Help Text". How I refer present focused textfield value in their "Help Text" property.
Regards
Kiran AkkirajuKiran,
The current value in session state of the item is available using &ITEM. notation (note trailing period). For example in the help text for item P1_X you can type:
Current value of this item is &P1_X..
Scott -
Accessing Childten MCs with MouseEvents in AS3
Hi,
I now have working code that creates a mask of about 2,700
children on a 650 by 450 image using a container to hold all the
children's MCs.
Can anyone provide any help as to how I can access these
children at once with a MouseEvent so that I could for instance
change the alpha value of a child shape when the user rolls over it
with their mouse.
I have attahced the code to this post.
Thanks in advance for any of the help provided as I've been
learning to use AS3 from AS2.
Best,
Justini was just thinking that i wonder if the clips are on stage?
and it looks like the problem may be in the loop declarations i
think what you want should be more like:
for(var i=0; i<original_mc.height / commaTile_mc.height;
i++)
but at the time of the loop the value of commaTile_mc.height
cannot be determined - you need to use a constant value there,
whatever the height and width of the actual tile mc are - use a
number.
i think the lines you have there are 'not' executing the
loop. -
How to use MS Access database in Flash CS4 using AS3
Hello everyone,
I need help for how use the MS Access database in FlashCS4 and I want to save and retrive the data from the database and display in the Flash window.
Thanks with,
Viswa.http://www.northcode.com/blog.php/2011/05/06/Using-ADO-Data-Sources-in-Flash-Projectors
-
Crash on Tweening a TextField with a mask AS3 CS3
I have yet to hunt down exactly what it is about this
situation that makes it crash, but when I tween the position of a
TextField that has a mask, as soon as I close the movie window the
program crashes, whether it be in the Flash (CS3) IDE or in a
browser.
In detail: I have a movie where I'm creating 1000 instances
of a movieclip (little dots) and when the mouse rolls over one i
instantiate another movieclip, call it box. I then dynamically
create a textfield inside the box and give it a mask (a generated
sprite that is just a rectangle half the width of the box, which is
added to the box's display list). Finally, I tween the x position
of the TextField, giving the effect of the text sliding out from
the edge of the box. When I test the movie in Flash this works fine
but as soon as I close the window Flash crashes, in a browser
window when I close the window I get the spinning beach ball of
death. If I dont add a mask to the TextField, I dont have this
problem at all. I will test this on a PC tomorrow, but as of yet
can only confirm on a Mac.
Has anyone ever encountered something like this?
I dont have the code in front of me, but it is really what
youd imagine, along the lines of (NOTE: this is not my exact
code):I have the same problem in version CS6. I assume Adobe hasn't done anything about it?
-
Accessing Captivate 6 with Flash 6 AS3
Is there no simple way to just change this code to make a drag and drop interaction work in CP6 that used to work in CP5.5? See bold text below...
It could be some time before we get the CP8 upgrade which includes D&D natively. (I'm using CP6 on a standalone computer without internet access, so can't download the new D&D widget.)
I've been searching for some time for a better answer than to use the WidgetFactory to redo the whole thing.
I tried the New>Widget in Flash option, but there is no guidance for using that intimidating looking page of code that pops up.
Is there a basic tutorial for using that somewhere?
thanks.
alan
import flash.display.MovieClip;
var dragArray:Array = [POS, PAS, PEC, RGR, AFSC, GRD, OSC];
var matchArray:Array = [POSMatch, PASMatch, PECMatch, RGRMatch, AFSCMatch, GRDMatch, OSCMatch];
var currentClip:MovieClip;
var startX:Number;
var startY:Number;
var counter:Number;
var resText:String;
counter = 0;
for(var i:int = 0; i < dragArray.length; i++) {
dragArray[i].buttonMode = true;
dragArray[i].addEventListener(MouseEvent.MOUSE_DOWN, item_onMouseDown);
//matchArray[i].alpha = 0.2;
function item_onMouseDown(event:MouseEvent):void {
currentClip = MovieClip(event.currentTarget);
startX = currentClip.x;
startY = currentClip.y;
addChild(currentClip); //bring to the front
currentClip.startDrag();
stage.addEventListener(MouseEvent.MOUSE_UP, stage_onMouseUp);
function stage_onMouseUp(event:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, stage_onMouseUp);
currentClip.stopDrag();
var index:int = dragArray.indexOf(currentClip);
var matchClip:MovieClip = MovieClip(matchArray[index]);
if(currentClip.hitTestObject(matchClip)) {
//a match was made! position the clip on the matching clip:
currentClip.x = matchClip.x;
currentClip.y = matchClip.y;
counter++;
trace(counter);
//counter.text = counter;
if (counter == 7) {
resTextbox.text = "Correct! Click the Next button to continue...";
//pop-up award graphic if wanted...
//iApprovePNG_mc.gotoAndPlay(2);
//This is to tell Captivate to continue (after the interaction)
var myRoot:MovieClip = MovieClip(root);
var mainmov:MovieClip = MovieClip(myRoot.parent.root);
mainmov.FlashDone = 1;
//make it not draggable anymore:
currentClip.removeEventListener(MouseEvent.MOUSE_DOWN, item_onMouseDown);
currentClip.buttonMode = false;
} else {
//match was not made, so send the clip back where it started:
currentClip.x = startX;
currentClip.y = startY;if flash is throwing errors, then it's possible the scoping is off and still accessing the flash timeline, not the captivate timeline
you can try and keep adding extra .parent one at a time like this:
var captivateVariables:* = Object(parent.parent).getMovieProps().variablesHandle;
var captivateVariables:* = Object(parent.parent.parent).getMovieProps().variablesHandle;
var captivateVariables:* = Object(parent.parent.parent.parent).getMovieProps().variablesHandle;
var captivateVariables:* = Object(parent.parent.parent.parent.parent).getMovieProps().variablesHandle;
var captivateVariables:* = Object(parent.parent.parent.parent.parent.parent).getMovieProps().variablesHandle;
see this about getMovieProps() -
Accessing iPhone & Android Contacts list from AS3?
Hello,
Is it possible to get the contact list from the iPhone & Android agenda (mobile and SIM card) by using AS3?
Regards.
J. Pablo.Hello,
I have to test it, but seems like it is almost the only reference to this issue.
I have also found few other things related to this link:
http://extensionsforair.com/extensions/contact-editor/
And another one related just to iOS:
https://code.google.com/p/as3iphone/source/browse/trunk/Classes/com/flashiphonedevelopment /address/IPhoneAddressBook.as
I have to test them, and I am very new, but thanks for your interest and help.
Regards.
J. Pablo. -
TextField - Adobe ActionScript 3 (AS3 ) API Reference
This question was posted in response to the following article: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.ht ml
"For AIR content in the application security sandbox, AIR ignores img tags in HTML content in ActionScript TextField objects. This is to prevent possible phishing attacks,"
Are you kidding me, right? O.o -
Hi all,
I'm using a JComboBox, a JButton and a JTextArea added to a JPanel. What I doing is using the TextArea as a console, the JComboBox to enter commands in (and retrieve old ones) and the JButton to execute entered commands. This works fine except for one thing. After I have executed a command and output has been written to the textarea(console) I want the focus to shift back to the combobox so that the user simply can enter another command. Using requestFocus() the drop down menu part of the combobox receives the focus and not the textfield part.
I have tried multiple ways of actually accessing the textfield component (combobox.getEditor().getEditorComponent().requestFocus()) to set the caret position to 0 but nothing seems to work.
Any thoughts or ideas will be appreciated.
Cheers,
MarcusTry calling transferFocusBackword on your JButton instance. Hope this helps.
-
Why can access the dynamic textField inside a Button?
yep, I have another problem
I create a button in the library, it has a background graphic
on a layer and a textField, the textField has a instance name
defined in the properties panels and some text. I manually place
some instance of the button on stage, I give them different
instance names and voilà a new problem arise
when with actionscript I try to assign a new text to the
textField inside a button it throws me error 1119. A quick look at
the menu option debug ->list objects, shows me that the instance
name of the textField inside the button it is not what I defined
but it was replaced with some random name like "instance66"
I did a test with a movieclip instead of a button and I can
correctly access my textField with the instance name that I
manually defined.
Why that can be the same with the button? And if for some
arcane reason cant be possible to access a manually defined
instance inside a button WHY flash give me the possibility to give
an instance name to a dynamic textField inside a button?Buttons simply do not have the same properties and methods
that movieclips have. Anytime you want to create a button that has
anything beyond the simple 3 states of activity, use a movieclip.
I can't answer why flash allows you to give an instance name
to the textfield, but in any case, it won't allow you to use
it. -
Write text out of bean into textfield/combobox
hy @ all!
i hope somebody can help me!
for better understanding i try to explain the logic behind my question:
on my login-page the user has to fill out the form with his/her username and password! after clicking on the "login" button i want to show the input of the login page in a textfield! data is saved in LoginFormBean!
a simple output like <bean:write...> is not the problem! but i didn't solved it with the textfield or combobox yet.
has anybody solved this problem?
please tell me the way!
thx
ciao davidIt's similar to a <bean:write>.
But instead of bean:write you use the <html:input> tag to create a textfield.
You need to have the LoginFormBean still in scope and
<html:input name="LoginFormBean" property="username"/> -
MXML attributes accessed via AS3
Hi,
I have a Delphi background and am struggling to learn Flex.
Understand that MXML and AS3 are effectively equivalent and
that MXML is translated into AS3.
However I do not seem to be able to access the same
properties, events in AS3 as I can access in MXML.
For example a Button component in MXML - I can access
properties and events (horizontalCenter, verticalCentre, click
event) which I do not seem to be able to access in a button object
instantiated in AS3.
Could anyone confirm that this difference is real or am I
missing something OR how can I access these properties, events in
AS3?"MalcolmSkels" <[email protected]> wrote in
message
news:gm768m$jqr$[email protected]..
> Hi,
>
> Thanks for the replies ? and patience for such a basic
query ? which has
> helped clarify things. It was mainly the Style issue
that was confusing
> me. I
> think I have got it now but would appreciate if someone
could confirm that
> I am
> correct in the following:
>
> <mx:Button label=?Test It?
click=?myButtonClickHandler()?
> horizontalCenter=?0?
> VerticalCenter=?0? />
>
> 1.
> In AS3 you cannot access any events of an object other
than by adding an
> event
> listener with the addEventListener method. So although
there is a click
> event
> for a Button which you can access in MXML as in the
example above there
> is no
> direct equivalent in AS3 ? you have to add a listener.
In fact, this is
> what
> the MXML translation does - in AS3 you have to do it
yourself.
>
> As you have both said a lot of properties are Styles and
can only be
> accessed
> in AS3 via the SetStyle method which adds up to a lot of
work just to set
> a few
> properties.
> Overall I am concluding that AS3 is pretty labour
intensive and that I
> should
> use MXML if at all possible and only drop into AS3 if
absolutely
> necessary. Is
> that correct? (Not intuitive for me)
If you're setting several properties at once, create an
object with all the
properties and use setStyle to set that or just set the
styleName to a style
you've set up in advance.
MPO is that AS3 is more intuitive, because most of the real
fine tuning
you'll need to do once you get past the roughing in will only
be documented
in the API, and I find that to use it in MXML you often need
to do a lot of
translating from the API documentation into how it works in
MXML, whereas it
pretty much works in as like it's documented in the API (most
of the time). -
Hi
I need to add accessibility to a flash program which I have
created.
I can make the screen reader state all of the different
buttons and at the top level of a combobox.
However if I traverse the combobox none of the items are
mentioned by the screenreader.
I've tried various things down to trying to set the
accessibility properties of the combobox items as though they were
an array
cb[0].accessibilityProperties = accessProps0;
but nothing seems to work.
I hope I'm just being stupid and it's a problem that someone
can help me easily with because I'm going nuts here!
Thanks in advancesorry - for some reason I'm creating a lot of duplicates
here. Please disregard this thread
Maybe you are looking for
-
How do I replace my software with a backup from my Time Machine?
I keep losing my cursor when I come back from sleep mode, so I am unable to shut down the computer, am forced to crash by holding down the Power Button.The apple store said my hardware is fine, so I might have to reinstall all my software and thus
-
Error in WRCR when trying to change material group of an article/material
We are using SAP 4.6c Retail. I'm trying to change a material group via transaction WRCR and the following message is displayed W7018 Error Checking valuation at retail for valuation area 2001. I've been looking every where I can think of, but I can'
-
Hi, When a new responsibility is added from the EBS forms UI to a user, the event oracle.apps.fnd.wf.ds.userRole.created is raised. If the responsibility is added to the user using the pl/sql stored procedure fnd_user_pkg.addresp, is the event oracle
-
Hello I am not able to understand this. I have BW statistics cube installed in my system in dev. Now when someone says we need to install BI Cockpit what is it....what is the difference in this....i have searched through forums but not able to get th
-
Hi gurus, In my custom exctractor i have taken date filed as delta field and i have taken one day in the upper limit. When i was doing the init laod with selection for date ' 01/09/2006 to 12/31/2099. the data is updating upto day before yesterday da