////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.core
{
import flash.display.FocusDirection;
import flash.events.Event;
import flash.html.HTMLLoader;
import mx.managers.IFocusManagerComplexComponent
import mx.utils.NameUtil;
/**
* FlexHTMLLoader is a subclass of the Player's HTMLLoader class used by the
* Flex HTML control.
* It overrides the toString()
method
* to return a string indicating the location of the object
* within the hierarchy of DisplayObjects in the application.
*
*
* @langversion 3.0
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class FlexHTMLLoader extends HTMLLoader implements IFocusManagerComplexComponent, IIMESupport
{
include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
*
Sets the name
property to a string
* returned by the createUniqueName()
* method of the mx.utils.NameUtils class.
This string is the name of the object's class concatenated
* with an integer that is unique within the application,
* such as "FlexLoader13"
.
As an optimization, if a child component in your component
* implements the IFocusManagerComponent interface, and you
* never want it to receive focus,
* you can set focusEnabled
* to false
before calling addChild()
* on the child component.
This will cause the FocusManager to ignore this component
* and not monitor it for changes to the tabFocusEnabled
,
* tabChildren
, and mouseFocusEnabled
properties.
* This also means you cannot change this value after
* addChild()
and expect the FocusManager to notice.
Note: It does not mean that you cannot give this object focus
* programmatically in your setFocus()
method;
* it just tells the FocusManager to ignore this IFocusManagerComponent
* component in the Tab and mouse searches.
false
, focus will be transferred to
* the first parent that is mouseFocusEnable
* set to true
.
*
* @default true
*
* @langversion 3.0
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get mouseFocusEnabled():Boolean
{
return _mouseFocusEnabled;
}
/**
* @private
*/
public function set mouseFocusEnabled(value:Boolean):void
{
_mouseFocusEnabled = value;
}
//----------------------------------
// tabFocusEnabled
//----------------------------------
/**
* @private
* Storage for the tabFocusEnabled property.
*/
private var _tabFocusEnabled:Boolean = true;
[Bindable("tabFocusEnabledChange")]
[Inspectable(defaultValue="true")]
/**
* A flag that indicates whether child objects can receive focus
*
* This is similar to the tabEnabled
property
* used by the Flash Player.
This is usually true
for components that
* handle keyboard input, but some components in controlbars
* have them set to false
because they should not steal
* focus from another component like an editor.
*
true
, draw the focus indicator,
* otherwise hide it.
*
* @langversion 3.0
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function drawFocus(isFocused:Boolean):void
{
}
/**
* Called by the FocusManager when the component receives focus.
* The component may in turn set focus to an internal component.
* The component's setFocus()
method will still be called when focused by
* the mouse, but this method will be used when focus changes via the
* keyboard.
*
* @param direction one of flash.display.FocusDirection
*
* @langversion 3.0
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function assignFocus(direction:String):void
{
stage.assignFocus(this, direction);
}
//--------------------------------------------------------------------------
//
// Event Handlers
//
//--------------------------------------------------------------------------
/**
* @private
*/
private function htmlRenderHandler(event:Event):void
{
_hasFocusableContent = hasFocusableContent;
}
//--------------------------------------------------------------------------
//
// Overridden methods
//
//--------------------------------------------------------------------------
/**
* Returns a string indicating the location of this object
* within the hierarchy of DisplayObjects in the Application.
* This string, such as "MyApp0.HBox5.FlexLoader13"
,
* is built by the displayObjectToString()
method
* of the mx.utils.NameUtils class from the name
* property of the object and its ancestors.
*
* @return A String indicating the location of this object
* within the DisplayObject hierarchy.
*
* @see flash.display.DisplayObject#name
* @see mx.utils.NameUtils#displayObjectToString()
*
* @langversion 3.0
* @playerversion AIR 1.1
* @productversion Flex 3
*/
override public function toString():String
{
return NameUtil.displayObjectToString(this);
}
}
}