troubleshooting Question

Triangle slider Volume control in Flex AS3 harder than it looks

Avatar of addmarketing
addmarketing asked on
Adobe FlashApache Flex
3 Comments1 Solution3535 ViewsLast Modified:
I am trying to make a volume control slider in as3 my media player was built in flex and the effect I am trying to get is http://www.actionscript.org/forums/showthread.php3?t=181799 I have been working on this for like 4 days now so I am looking for help finally. I tried this many different ways and I still ahve no luck I got a version working in flash not flex but the drag was set on the mask of and it was useless because you couldnt turn the volume down does anyone have any idea how this is done?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 
 
<mx:Script>
	<![CDATA[
	
	        import mx.managers.DragManager;
            import mx.core.DragSource;
            import mx.events.DragEvent;
            import flash.events.MouseEvent;
            
            [Embed(source='assets/trackgrey.png')]
            public var globeImage:Class;
                   
                      
 
            // The mouseMove event handler for the Image control
            // initiates the drag-and-drop operation.
            private function mouseMoveHandler(event:MouseEvent):void 
            {                
                var dragInitiator:Image=Image(event.currentTarget);
                var ds:DragSource = new DragSource();
                ds.addData(dragInitiator, "img");               
		trace(Image(event.dragInitiator).y);
                DragManager.doDrag(dragInitiator, ds, event);
            }
            
            // The dragEnter event handler for the Canvas container
            // enables dropping.
            private function dragEnterHandler(event:DragEvent):void {
                if (event.dragSource.hasFormat("img"))
                {
                    DragManager.acceptDragDrop(Canvas(event.currentTarget));
                }
            }
 
          
            
		   private function dragDropHandler(event:DragEvent):void {
                Image(event.dragInitiator).x = 
                    Canvas(event.currentTarget).mouseX;
                      
                Image(event.dragInitiator).y = 
                    Canvas(event.currentTarget).mouseY;
            }
	]]>
</mx:Script>
<mx:Canvas x="36" y="10" >
	<mx:Image x="152" y="192" source="assets/thumb.png" mask="{ maskImage }"/>
	<mx:Image x="152" y="205" source="assets/trackgrey.png" mouseMove="mouseMoveHandler(event);"/>
	
	
	
<mx:Image source="assets/thumb.png" x="518" y="10" mask="{ maskImage }">
 
</mx:Image>
 
<mx:Image source="assets/trackgrey.png" x="518" y="27" id="maskImage" cacheAsBitmap="true" mouseMove="mouseMoveHandler(event);">
	
</mx:Image>
	
	</mx:Canvas>
	
</mx:Application>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros