blob: cd8c0b5675dc9ae343ab2a08a8115eece8f1bec3 [file] [log] [blame]
////////////////////////////////////////////////////////////////////////////////
//
// 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 org.apache.flex.html.staticControls
{
import flash.display.DisplayObject;
import flash.display.SimpleButton;
import org.apache.flex.core.IBead;
import org.apache.flex.core.IBeadModel;
import org.apache.flex.core.IStrand;
public class Button extends SimpleButton implements IStrand
{
public function Button(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null)
{
super(upState, overState, downState, hitTestState);
// mouseChildren = true;
// mouseEnabled = true;
}
private var _model:IBeadModel;
protected function get model():IBeadModel
{
return _model;
}
private var strand:Vector.<IBead>;
public function addBead(bead:IBead):void
{
if (!strand)
strand = new Vector.<IBead>;
strand.push(bead);
if (bead is IBeadModel)
_model = bead as IBeadModel;
bead.strand = this;
}
public function getBeadByType(classOrInterface:Class):IBead
{
for each (var bead:IBead in strand)
{
if (bead is classOrInterface)
return bead;
}
return null;
}
public function removeBead(value:IBead):IBead
{
var n:int = strand.length;
for (var i:int = 0; i < n; i++)
{
var bead:IBead = strand[i];
if (bead == value)
{
strand.splice(i, 1);
return bead;
}
}
return null;
}
}
}