LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




ReplyREPLY THREAD
 
Thread Tools Display Modes
  #1  
Old 07-10-2007, 02:00 AM
mrpoate mrpoate is offline
Registered User
 
Join Date: May 2007
Posts: 4
Rep Power: 0
mrpoate is on a distinguished road
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
Reply With Quote
  #2  
Old 07-10-2007, 11:34 AM
mrpoate mrpoate is offline
Registered User
 
Join Date: May 2007
Posts: 4
Rep Power: 0
mrpoate is on a distinguished road
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
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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




All times are GMT. The time now is 05:01 PM.