Link to home
Start Free TrialLog in
Avatar of addmarketing
addmarketing

asked on

Triangle slider Volume control in Flex AS3 harder than it looks

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

Avatar of blue-genie
blue-genie
Flag of South Africa image

is it simply not doing the volume or is the whole thing not working i.e. the movement etc.
i'll copy your code over tonight and see if i can simulate it - don't have flex here at work.
Avatar of addmarketing
addmarketing

ASKER

Its the movement, I got the movement working semi in flash bye making the mask drag-able but the issue was i couldn't drag the volume down unless I had moved the mouse over the mask the was all the way over the the right. If you could help me with this you would be a life saver, I can help you out with scripts and design work in exchange.
ASKER CERTIFIED SOLUTION
Avatar of addmarketing
addmarketing

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial