Anybody?
--- In [email protected], "stldvd" <stl...@...> wrote: > > Below is the code for a simple Flex actionscript project. A sprite is > partially covering a hyperlink. What's happening is that when you hover over > the sprite, if you're also hovering over the hyperlink, the hyperlink is > activated. I want to prevent that. I want the hyperlink to be activated only > when the mouse hovers over it -- but not when the mouse hovers over the > sprite which covers it. > > Does anyone know how to do this? (I tried replacing the sprite with a > simpleButton and the same thing happens). > > package { > import flash.display.Sprite; > import flash.events.Event; > import flash.events.MouseEvent; > import flash.events.TextEvent; > import flash.external.ExternalInterface; > import flash.text.Font; > import flash.text.StyleSheet; > import flash.text.TextField; > import flash.text.TextFieldAutoSize; > import flash.text.TextFormat; > > > public class SpriteHyperlinkTest extends Sprite > { > private var style : StyleSheet = new StyleSheet(); > public function SpriteHyperlinkTest() > { > createOutputTextField(); > } > > public var output_txt : TextField; > > private function createOutputTextField() : void { > > var hover : Object = new Object(); > hover.fontWeight = "bold"; > hover.color = "#0000FF"; > var link : Object = new Object(); > link.fontWeight = "bold"; > link.textDecoration = "underline"; > link.color = "#555555"; > var active : Object = new Object(); > active.fontWeight = "bold"; > active.color = "#FF0000"; > > var visited : Object = new Object(); > visited.fontWeight = "bold"; > visited.color = "#cc0099"; > visited.textDecoration = "underline"; > > style.setStyle("a:link", link); > style.setStyle("a:hover", hover); > style.setStyle("a:active", active); > style.setStyle(".visited", visited); > output_txt = new TextField(); > output_txt.backgroundColor = 0xFFFFFF; > output_txt.background = true; > //output_txt.embedFonts = true; > output_txt.wordWrap = true; > output_txt.multiline = true; > > output_txt.name = "output_txt"; > output_txt.x = 100; > output_txt.y = 100; > output_txt.width = 300; > output_txt.height = 200; > > output_txt.htmlText = "<b>sample <a > href='http://www.google.com'>hyperlink text</a></b>"; > addChild(output_txt); > var mySprite:Sprite = new Sprite(); > mySprite.graphics.lineStyle(.5,0x000000); > mySprite.graphics.beginFill(0xff0000, 1); > mySprite.alpha = .7; > mySprite.graphics.drawRect(100, 100, 90, 20); > mySprite.graphics.endFill(); > mySprite.useHandCursor = true; > mySprite.mouseChildren = true; > mySprite.buttonMode = true; > mySprite.name = "Sprite1"; > this.addChild(mySprite); > > output_txt.styleSheet = style; > } > > } > } >

