
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
textfield focus problem in external swf
Hi
Ok, I actually made a thread about this problem on another account but I forgot my password for that account so I hope its ok if I make a new thread about the problem. This is my situation. I've got a flash file that loads an external swf into it. Inside the external swf file is a form containing textfields that use onSetFocus and onKillFocus = function() {blah blah} to change their background colour when clicked on/when active. I'm loading the external swf file into an empty movieClip using the loadMovie() command/function. It loads in fine and works. Almost. My problem is that although the background-changing effect of the textfields in the external swf works when I click on them, it only works properly when switching between them. In other words, I can't take focus away from the textfields, which is a problem for the swf I made. In case you are having trouble understanding my problem (I don't think I expressed it very well), I uploaded the file to show you what I mean. Here's the link: http://www.moorwood.net/Interface.swf You'll notice (or at least I think you will- unless other computers treat the flash file differently to mine) that you can't take focus away from the textfields in the inner create account swf, which is a bugger because you need the focus to be away from them if you want to move properly between the different races you can choose from (it's supposed to be a medieval/fantasy kinda game, so yeah). One of the moderators (think it was Paul Ferrie) replied to my post on my other account, and suggested I used lockroot in my external file. Tried that and unfortunately didn't seem to work (I'd already removed all references to _root, so yeah). Anyway, I do have a workaround, which is using loadMovieNum to load the external swf into a level rather than a movieClip. This fixes the problem, allowing the textfields to lose focus, but it causes some other annoying problems. The main one is that despite my use of a level-positioning script, which does work, the external swf sometimes is positioned wrongly (appearing at the top left rather than in the middle as is needed). I think this has something to do with the cache, as I noticed that the positioning problem only seems to happen when I first load the file and if I reload the page (which would cause the file to be called from the cache, right?) it fixes itself up. Ok, sorry about how dense this post is. Any help or ideas would be much appreciated, Thanks in advance |
|
#2
|
|||
|
|||
|
Solution...If anyone needs it
Managed to find a solution to my problem, so if there's anyone out there who experiences a similar problem I hope this helps.
Turns out the FocusManager class checked if the newFocus property in the onKillFocus = function(newFocus) function was null, and when it was, set the focus back to the object which last received focus. In other words, when I tried switching the focus away from the textfields onto a different area of the stage that didn't contain an object able to receive focus, the focus reverted back to the textfields. Which was extremely annoying. The problem is explained in this thread on a different forum: http://www.actionscript.org/forums/a...3/t-90083.html The solution, invented by the person in the thread, is to simply place: _root.createEmptyMovieClip("noFocus",focusManager. getDepth()); in the the file that calls the external content (i.e the parent/main file). Admittedly, as I'm fairly new to flash, I don't fully understand the line of code, although I do have a basic understanding of what it does. Basically, it creates an empty moveClip called "noFocus" (obviously you can call it what you like) and replaces FocusManager with that empty movieClip. Thus, it prevents FocusManager from affecting the file. It's all pretty much explained in the thread, and I hope I've interpreted the information from it correctly (if not, someone correct me please). Anyway, hope that helps someone out- it was a problem that bugged me for a while |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MC Button problems within an external swf file | cjrollo | Newbies |
0 | 04-10-2007 06:04 PM |
| loading an external swf in maximised state | globe75 | Newbies |
1 | 11-24-2006 05:57 PM |
| Attaching and placing external swf | perevers | Flash 8 |
1 | 10-15-2006 08:43 PM |
| Position screen contentpath content, preloading external jpg within external swf | Manca | Flash MX ActionScript |
0 | 01-16-2006 07:09 PM |
| load of external swf with strange problem | carlos_abreu198 | Flash MX |
5 | 07-07-2005 03:17 PM |



