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>

Open in new window

ASKER CERTIFIED SOLUTION
addmarketing

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004