ActionScript 2.0 :: Small On Key.ENTER Handling?
Nov 26, 2004
Code:
// msg_box_txt is a TextField for user input
// by hitting ENTER, it sends msg_box_txt.text
var my_listener:Object = new Object();
my_listener.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
[Code]...
msg_box_txt should be cleared, empty, after hitting ENTER. the problem that it contains one empty line, and the cursor is at beginning of the second line. how can this be fixed??
View 1 Replies
Similar Posts:
Aug 11, 2010
we have a C++ application that hosts a flex application in a MFC dialog. Everything works fine, all button pushes etc are passed directly on to flex with no problem at all, except the enter and escape keys, which immediately closes the dialog. We can trap the enter key, by implementing PreTranslateMessage() or OnOK() and impede the window closing behavior, but we still have the problem of passing these enter key pushes on to the hosted flex app further. There is no "default" button on the form or anything like that, perhaps MFC is linking the enter key to the close button in the title bar behind the scenes or something. Does anyone have any ideas how we can stop MFC from treating the enter key from being a special case.[code]
View 4 Replies
Jun 23, 2011
When my focus is inside the input text field, pressing CTRL+ENTER works but ENTER does not.Pressing Enter when my focus is anywhere BUT the input text field works just fine..My intention is to detect if ENTER key was pressed after the user fills out the field, but it seems to only work for CTRL+ENTER
ActionScript 3:
// works:
stage.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);
// ignored:
email.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);
[code]....
ENTER results in charCode == 0, whereas CTRL+ENTER is charCode == 13 email was created using the Text tool and set to "Editable"
Note: I am testing in Chrome and Firefox running Flash v10
View 1 Replies
Aug 20, 2007
I'm creating a Flash instant messaging application (through XMPP protocol) and run into a problem. It isn't that important but I was quite upset that I wasn't able to solve it and I want to know if their is a solution =D
I have a TextArea chat input and a button to send the text, the TextArea is multiline and so captures the Enter key to jump one line... What I need is to send the message with the Enter key and jump with a Ctrl+Enter combination... My ideas were to disable the bubbling of the Enter key, trap it, and then manually assign the Ctrl+Enter combination to jumping the line in TextArea but couldn't find how to do all this...
View 3 Replies
Jun 13, 2010
I had a quick question, I have a movieclip with 15 frames in it with an image on each frame, and a stop action on each frame. On my main stage I have 15 different buttons, which when pressed will change the movieclip to that particular frame (so pressing button 3 would make the mc go to frame 3). I'm still rather new to AS3, but I figured the most simple way to do this was a function which was called when the buttons are pressed
[Code].....
View 2 Replies
Jul 27, 2009
I am trying to get metadate from my NetStream object and do things depending on what is going on. here is what I have, but I get an error I don't know what it means.
var customClient:Object = new Object();
customClient.onMetaData = metaDataHandler;
function metaDataHandler(infoObject:Object):void {
[code]....
The error I get is:Error #2044: Unhandled AsyncErrorEvent:.text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=TypeError: Error #1010: A term is undefined and has no properties.
at AMG_ASP_ICS_072709_fla::MainTimeline/frame1()
View 6 Replies
Apr 28, 2011
How do you communicate an error to the web service consumer ?
For example, my web service has a function to insert employee into db.Suppose while inserting the data , the database gave an error,what should be the best way to inform the user about the error.
One way is to depict it through the return value of the web service method but what to do when the function is supposed to return a complex object like employee when there is no error ,and will send an error string when there is an error ?
View 1 Replies
Apr 3, 2009
I need to export a 60 animation from flash. It has text and image animation on the timeline, no actionscript. The swf file when published is 5 mb. When I export as an .mov, it is 768 mb. Also, there is some jumping and stuttering.
View 1 Replies
May 10, 2010
Actionscript Code:
function createNames(){var counter:Number = 1; for each(var ca:Categorie in arrCategories) if(ca.Name == currentMonster.name) for each(var ch:Channel in ca.Children)
[code].....
View 1 Replies
Aug 22, 2009
I have a bit of code listens for a user to click a navigation item, however if they click another nav item then my code loads both of them and puts the content pages on top of each other.I am having loads of problems with this bit of code.
PHP Code:
private function _menuSelectHandler (event : MenuEvent):void {
if (! event.abstract) {
[code].......
View 7 Replies
May 17, 2010
I have a problem with event handling. I'm working on a calendar, on which events can be listed. With actionscript i loop through an XML file with the days (and if there, the events for that day). So far so good. Where it goes wrong is this: I only want to display blocks with the day numbers on it. When you click on a day, a box pops up and shows the event's for that day.
This is what i did: created a movieclip with classname mc. loop trough the xml file and for each day create a new instance of mc with the day number as text on it. This al works, but now i want to add an eventhandler for each day. How to do this?
View 1 Replies
Jun 29, 2009
I'm asking many questions these days but its really urgent
I am doing an application to load xml file into data grid and everything is done now. The only thing left is that i wanna make sure that if the xml file isn't there, the user will not have a runtime error.I have the following code to load the file.
var myXML:XML = new XML();var XML_URL:String = "questions.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
i tried many ways i found on the net using try and catch but didnt work. Anyone can write me the peice of code to hande this error if the file is not there??
View 1 Replies
Oct 1, 2009
Can I write more than one command in a script? I am having trouble making an if-code in Flash CS4.This code is working as I want:
stop();
instans1.onMouseDown = function (){
play();
[code].....
View 5 Replies
Jan 5, 2010
If I have a graphic that is fully transparent in places, can I make only the non-transparent portions of the graphic respond to mouse clicks? I realize I can probably do this with a few lines of code, e.g. detect the click and then check the alpha value under the mouse. But I was looking for something simple. For example, in Director there is an "alphaThreshold" in a graphic that determines at what alpha value a bitmap will respond to mouse clicks. Does Flash / AS3 have a similar capability?
View 1 Replies
Oct 27, 2011
I'm working on a game, that loads up external text files to create maps. There is a error if the player moves out of bounds, and there is no map to load. All I need is a sort of check to see if the text file actually exists, before loading it
View 3 Replies
Jul 31, 2009
I'd like to arrange things so that I have a chain of keyboard event handlers in my flex application, all of whom are queried when key down events occur. Basically, when a visual component is on screen, it is a candidate for handling a key press event. Something like this (clearly this is pseudocode):
<application handles_keys="F5, F6">
<tabGroup>
<tab1 handles_keys="pgup, pgdn">
<control handles_keys="0,1,2,3,4,5,6,7,8,9" />
[code]...
I have a class written that will respond to the key events the way I want it to, so how do I register one or more instances of this class to have the results I want? Also, note that there are some situations where this class should receive events that would ordinarily be handled by a UI component. The TAB key is the main example; I have a few cases where I want my key down event handler to fire even when the focus is on a text field.
View 3 Replies
Apr 1, 2010
We have a Flex client and a server that is using the Spring/Blazeds project. After the user logs in and is authenticated, the spring security layer sends a redirect to a new URL which is where our main application is located. However, within the flex client, I'm currently using HTTPService for the initial request and I get the redirected page sent back to me in its entirety. How can I just get the URL so that I can use navigatetourl to get where the app to go where it needs to?
View 2 Replies
Feb 11, 2011
I am building a Flex application using Pure MVC pattern and Zend framework for calling php code on the server. I need to sync some data with my server which is using MySQL as the database. And there are 5 such tables I need to sync. So I call these php functions at regular intervals from Flex and use long polling on php side. The client side code for my subjects lies in 5 different proxies.
Should I send 5 separate requests from each proxy to call the php code which is lying in separate classes. Or should I build a separate proxy to send 1 request from 1 php file and then distribute this data among different proxies on the client side. Which one will be more effecient? Mathematics shows using separate proxies and php classes allow more number of users to be accomodated on the server.Can I write 1 SQL command to fetch data from all 5 tables given they cant be joined on any column?
View 1 Replies
Jul 5, 2009
I'm building an application, where objects are attached on a canvas and the tree of that canvas is held on a tree component. Each time that i attach an object the tree adds a new child etc. I want to do this on the other way around.. I want to press a tree node and "communicate" with the specific object, so that i can change its color, delete it etc. I've tried some things but nothing happens!This is my code:
var working_space:XML = new XML();
working_space.addTreeNode("Canvas",0);
myTree.dataProvider = working_space;
[code]......
View 0 Replies
Dec 29, 2009
I have a very simple Flash movie with multiple keyframes. Each keyframe has buttons which I'll be attaching event listeners.
I was hoping that I could add all event listeners to all buttons in all keyframes by using a document class. This works for buttons in frame #1, but anything else gets a null reference exception:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
I also tried adding a layer to the timeline that spans all keyframes and putting in the eventlisteners (and respective addEventListeners) there. Same thing - null reference exceptions for everything not in frame #1.
View 7 Replies
Feb 10, 2010
I'm used to building web apps using proper architectures, but relatively new to the RIA space.One of the issues in rich client app is approaches to handling communication across components. (I've played around using the EventBroker concept.)In a recent Flex3/AS app I was looking at they took an approach that seemed to work pretty well, but I wonder about the drawbacks (or any other pros)...They took the concept of having a singleton object that would hold objects that could be used obviously from any components within the app by a simple call to...
var myAppModel:AppModel = AppModel.getInstance();
You thus could put any objects in there that you wanted access to from different components. It seemed to serve as the equivalent of a "Session" in the JEE space. I'm not so sure from an OO perspective it's the best thing to do, but it did seem to work pretty well.
View 4 Replies
Aug 31, 2010
If you have a larger project, how do you manage your custom events, do you put all of them in a single class or make multiple classes?
View 2 Replies
Oct 18, 2010
Have been dabbling with flash for few years, but would like to send data to external PHP file and would like flash to process response.The way I have it working is to register function for the submit button on the main stage where I have the form instance. However, when I do this, it stops rollover effects from working on submit button. (The button is actually a movie clip instead of straight forward button btw.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Form code below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
[code]....
View 1 Replies
May 19, 2011
on clicking the Search Icon , a search bar will be visible (ON) if user click anywhere on the stage the search bar will be NO visible(OFF) OR user click on ICON again the search bar will be OFF but it Stage CLICK is triggered without clicking
Code:
searchIcon.addEventListener(MouseEvent.CLICK, showSearch);
var srchBox:Boolean = true;
function showSearch(event:MouseEvent):void
[code]...
View 2 Replies
Jun 10, 2011
I am trying to create an app that will read files form a local folder on a memory stick (flash drive) which the app will be on too, then I need to be able to move one of the files in this local directory to a specified folder on the system BUT there has to be a variable taken from a text input to complete something along the lines of
[Code]...
View 2 Replies
Feb 4, 2004
I have a class with a XML object in it. In one of the class' methods, I tell the XML object to load a document. Before I do that, I set up the onLoad event to call one of the class' other methods. The problem is that in that handler function, I can't seem to access any of my class' data. If I try to use the "this" pointer, I'm getting the XML object not my class.
A simple example:
[AS]
class MyClass
{
var theXML:XML;
[code]....
View 2 Replies
Apr 20, 2004
Data=["M", "XYZ", "1/1/00"]
Attributes=["sex", "name", "date"]
Search=["sex", "name", "date"]
var orignal="{sex}<b>{name}</b>{date}"
I am getting a string from XML file in the above format which i am storing in original varible. But at the time of showing the output, I want values of the variables ( {sex} ..those are in culy braces) to be displayed which are their in array Data....like for sex value is M ..for name it is xyz...etc...and the values should be displayed in a format defined in the strring....so how do i create a new string which would look like this...newstring="M<b>xyz</b>1/1/00"
View 2 Replies
Jun 28, 2011
I've developed an FLEX application for distributed data administration. When our Asian employees specify a date, it will be saved +1 day.If I check my timezone offset it is +60, their offset is +520.
var dNow:Date = new Date();
trace("Your time zone offset: " + dNow.getTimezoneOffset() + " minutes");
I assume this is the problem? If so, would you suggest that I correct the entered date by 460 minutes before sending it to our server for saving? How to do that?
View 2 Replies
Jan 27, 2009
Code:
import flash.display.Sprite;
var sp1:Sprite = new Sprite( );
var sp2_1:Sprite = new Sprite( );
[Code]....
I'd assume from this that there is no correcting done for children with the same name being added to the same parent. I ask this question because I'm creating a structure that needs to mimic the display list and I'd like to keep behavior consistent.
Another question: I'd assume internally the children are saved in something similar to a Dictionary object, does anyone know if this is true? And then getChildByName simply does a foreach loop and returns the first match on a name?
View 2 Replies
Apr 28, 2009
I am having mainly 2 problems in Flash for some time and I need some clarifications on them.
1. Handling pages.
How do I handle working with pages in Flash? Do I create a frame for each page and place the content of the page in that frame and when needing to go to a page I simply go to it's frame? Or do I use ActionScript to put and remove content from the stage and create every page in this way? What I mean by this is: if a page has a menu and a picture, I use ActionScript to put the menu and the picture there. If the next page has some text and a button, I use ActionScript to remove the menu and the picture from the last page and put the text and the button from the new page.
The first method seems simpler but that means that if the page has some content that needs to be loaded (a picture, for example), this content will need to be loaded every single time the page is opened.
The second method requires more work but is it more efficient ? When I remove the content from the page, do I move it to a negative x and y so that it cannot be seen or do I remove it completely and just load it again the next time the page is opened?
2. Handling a flow communication with PHP.
I constantly need to communicate back and forth with PHP. I use a LoadVars variable to send data to PHP (using "POST") and I use an XML variable to retrieve data from PHP (I use the "sendAndLoad" method). The data sent by PHP is in an XML structure. The problem here is that I need to have different channels working. I need to receive several different types of data. Do I create a set of LoadVars and XML variables for each type of data that I need to receive or do I simply use only the one set and use an ID variable to specify with which type of data I am working at the moment ?
View 1 Replies