Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to get focus on canvas
    text
    copied!<p>I am creating a canvas in actionscript like :</p> <pre><code>private var cvs_preview:Canvas = null; private function show_preview():void { this.cvs_preview = new Canvas(); this.cvs_preview.id = "cvs_preview_1"; this.cvs_preview.setStyle('backgroundColor', 0x000000); this.cvs_preview.setStyle('backgroundAlpha', 1); this.cvs_preview.setStyle('borderColor', 0x417FDD); this.cvs_preview.setStyle('cornerRadius', 10); this.cvs_preview.setStyle('borderStyle', 'solid'); this.cvs_preview.setStyle('dropShadowEnabled', true); var pt:Point = image.localToGlobal(new Point(image.x, image.y)); this.cvs_preview.x = pt.x - 50; this.cvs_preview.y = pt.y - 50; this.cvs_preview.height = 200; this.cvs_preview.width = 250; //this.cvs_preview.addEventListener(FlexEvent.CREATION_COMPLETE, get_focus_on_canvas); //this.cvs_preview.focusManager.setFocus( //this.cvs_preview.addEventListener(MouseEvent.CLICK, end_preview_on_focus_change); this.cvs_preview.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, end_preview_on_focus_change); Application.application.addChild(this.cvs_preview); //add as top-most visible container btn_mini_preview.enabled = false; } </code></pre> <p>So on the focus change i want to run the "end_preview_on_focus_change()" </p> <p>but this is not working. </p> <p>As per my understanding, i think the canvas not getting any focus in the first place. I was trying to use focusManager.setFocus to do that after the canvas's creation complete. but even that is giving me an error. </p> <p>the code i was trying on Creation.Complete is :</p> <pre><code>private function get_focus_on_canvas(e:FlexEvent) { focusManager.setFocus(e.target); //Alert.show("testing img complete"); } </code></pre> <p>this is giving me an error "1118: Implicit coercion of a value with static type Object to a possibly unrelated type mx.managers:IFocusManagerComponent."</p> <p>basically i just want to use the focus out event of the canvas. </p> <p>Can someone help me with this... I have been on this issue since a long time. </p> <p>Regards Zeeshan</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload