Permalink
Browse files

flash file will only copy. Tooltip in JS

  • Loading branch information...
1 parent 6ef5853 commit 0f80902792a1cea1773a77b9cca33c3945a2eebf @jangid committed May 8, 2012
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
View
Binary file not shown.
View
@@ -4,40 +4,52 @@
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
- <div id="main" style="width:80px">
- Hello World
- <div id="clipper-wrapper" style="position: absolute; z-index: 9998; width: 200px; height: 60px; left: -9999px; top: -9999px; ">
- <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ <div id="main">
+ Hello <span id="clipper-placeholder"><img src="assets/button_up.png" alt="placeholder image"></img></span> World
+ </div>
+ <div id="clipper-wrapper" style="position: absolute; z-index: 9998; width: 14px; height: 14px; left: -9999px; top: -9999px; ">
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ width="100%"
+ height="100%"
+ id="clipper" title="copy">
+ <param name="movie" value="build/clipper.swf"/>
+ <param name="allowScriptAccess" value="always" />
+ <param name="quality" value="high" />
+ <param name="scale" value="noscale" />
+ <param NAME="FlashVars" value="text=Hello Zindagi">
+ <param name="bgcolor" value="#ffffff">
+ <embed src="build/clipper.swf"
width="100%"
height="100%"
- id="clipper" title="copy">
- <param name="movie" value="build/clipper.swf"/>
- <param name="allowScriptAccess" value="always" />
- <param name="quality" value="high" />
- <param name="scale" value="noscale" />
- <param NAME="FlashVars" value="text=Hello Zindagi&toolTipStart=Copy to Clipboard&toolTipEnd=Copied!">
- <param name="bgcolor" value="#ffffff">
- <embed src="build/clipper.swf"
- width="100%"
- height="100%"
- name="clipper"
- quality="high"
- allowScriptAccess="always"
- type="application/x-shockwave-flash"
- pluginspage="http://www.macromedia.com/go/getflashplayer"
- FlashVars="text=Hello Zindagi&toolTipStart=Copy to Clipboard&toolTipEnd=Copied!"
- bgcolor="#ffffff" title="copy"/>
- </object>
- </div>
+ name="clipper"
+ quality="high"
+ allowScriptAccess="always"
+ type="application/x-shockwave-flash"
+ pluginspage="http://www.macromedia.com/go/getflashplayer"
+ FlashVars="text=Hello Zindagi"
+ bgcolor="#ffffff" title="copy"/>
+ </object>
+ </div>
+ <div id="clipper-tooltip" style="position: absolute; z-index: 9998; width: 100px; height: 60px; left: -9999px; top: -9999px; ">
+ Copy To Clipboard
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
- var position = jQuery('#main').position();
- var width = jQuery('#main').width();
- var clipper_left = position.left + width;
- var clipper_top = position.top;
- jQuery('#clipper-wrapper').css('left', clipper_left);
- jQuery('#clipper-wrapper').css('top', clipper_top);
+ var position = jQuery('#clipper-placeholder').position();
+ jQuery('#clipper-wrapper').css('left', position.left);
+ jQuery('#clipper-wrapper').css('top', position.top);
+ jQuery('#clipper-wrapper').hover(
+ function() {
+ jQuery('#clipper-tooltip').css('left',
+ position.left + 7);
+ jQuery('#clipper-tooltip').css('top',
+ position.top + 14);
+ },
+ function() {
+ jQuery('#clipper-tooltip').css('left', '-9999px');
+ jQuery('#clipper-tooltip').css('top', '-9999px');
+ }
+ );
});
</script>
</body>
View
@@ -8,51 +8,49 @@
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
- import mx.managers.ToolTipManager;
- import mx.controls.ToolTip;
[Bindable]
public var clipperText:String;
- public var clipperTipStart:String;
- public var clipperTipEnd:String;
- public var clipTip:ToolTip;
+
+ [Embed('assets/button_up.png')]
+ public var iconUp: Class
+
+ [Embed('assets/button_over.png')]
+ public var iconOver: Class
+
+ [Embed('assets/button_down.png')]
+ public var iconDown: Class
private function initVars():void {
clipperText = FlexGlobals.topLevelApplication.parameters.text;
- clipperTipStart
- = FlexGlobals.topLevelApplication.parameters.toolTipStart;
- clipperTipEnd
- = FlexGlobals.topLevelApplication.parameters.toolTipEnd;
+ main_button.setStyle('icon', iconUp);
}
protected function main_button_click():void {
flash.system.System.setClipboard(clipperText);
- ToolTipManager.destroyToolTip(clipTip);
- if(clipperTipEnd) {
- clipTip
- = ToolTipManager.createToolTip(clipperTipEnd, 0, 20,
- 'errorTipBelow') as ToolTip;
- }
}
protected function main_button_over():void {
- if(clipperTipStart) {
- clipTip
- = ToolTipManager.createToolTip(clipperTipStart, 0, 20,
- 'errorTipBelow') as ToolTip;
- }
+ main_button.setStyle('icon', iconOver);
}
protected function main_button_out():void {
- ToolTipManager.destroyToolTip(clipTip);
+ main_button.setStyle('icon', iconUp);
+ }
+ protected function main_button_down():void {
+ main_button.setStyle('icon', iconDown);
+ }
+ protected function main_button_up():void {
+ main_button.setStyle('icon', iconUp);
}
]]>
</fx:Script>
<s:Button id="main_button"
- icon="@Embed(source='assets/button.png')"
- width="20"
- height="20"
+ width="14"
+ height="14"
click="main_button_click()"
mouseOver="main_button_over()"
mouseOut="main_button_out()"
+ mouseDown="main_button_down()"
+ mouseUp="main_button_up()"
/>
</s:Application>

0 comments on commit 0f80902

Please sign in to comment.