Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

how to put some shadow effect to image in adobe flex

Hi Expert,

I have two images , when i click first image, i need to put some shadow effect on that image, and the shadow should disappear on first image when i click second image. This time shadow has to be appear on second image. it is kind of which image i have selected.
Please can i have some sample code for getting this shadow effect?

Thanks,
Alpita

0
Alpita
Asked:
Alpita
1 Solution
 
jimswebCommented:
Try this one:

private function changeImage():void
{
 var MyFilter : DropShadowMyFilter = new DropShadowMyFilter();
 MyFilter.blurX = 5;
 MyFilter.blurY = 5;
 MyFilter.quality = 3;
 MyFilter.alpha = 0.5;
 MyFilter.angle = 45;
 MyFilter.color = 0x202020;
 MyFilter.distance = 7;
 MyFilter.inner = false;
 modifiedImage.MyFilters = [ MyFilter ];           
    
 }

Open in new window

0
 
dgofmanCommented:
Use flash.filters.DropShadowFilter class

import flash.filters.DropShadowFilter;

private var lastShadowImage:Image;

private function showShadow(event:Event):void{
      if(lastShadowImage)
            lastShadowImage.filters = null;
      lastShadowImage = event.target as Image;
      var shadow:DropShadowFilter = new DropShadowFilter();
      shadow.distance = 10;
      shadow.angle = 25;
      lastShadowImage.filters = [shadow];
}

<mx:Image source="@Embed(source='Images1.png')" mouseDown="showShadow(event)"/>
<mx:Image source="@Embed(source='Images2.png')" mouseDown="showShadow(event)"/>
0
 
AlpitaAuthor Commented:
thanks for the response. It is showing effect now, but i have third image which should not show effect(just image with out any effects). When i click third image, previous selected image effect is disappearing, it should not disappear with click of third image. I used removeEventListener() for third image.

I did like this:
-----------------
if(data.deviceType == "CLOUD") {
                                    image.removeEventListener(MouseEvent.MOUSE_DOWN, onClick);
                                    image.removeEventListener(MouseEvent.MOUSE_UP, onClick);            
                              }
private function onClick():void{
//////////
}

any thing wrong in my code?
0
Managing Security Policy in a Changing Environment

The enterprise network environment is evolving rapidly as companies extend their physical data centers to embrace cloud computing and software-defined networking. This new reality means that the challenge of managing the security policy is much more dynamic and complex.

 
dgofmanCommented:
Why do u need to assign event for your third image from begging?
Don't call my function

<mx:Image source="@Embed(source='Images3.png')">
0
 
dgofmanCommented:
Are you sure you excepted a correct answer?
0
 
AlpitaAuthor Commented:
I dont know why it is showing like this.
I just accepted the solution
0
 
dgofmanCommented:
But you accepted your comments, I will glad if you will accept a correct answer.
0
 
ModernMattCommented:
Restarting the close process.

ModernMatt
Experts Exchange Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now