Pages

0 comments

Customise Combobox/DropDown in Flash

I am always wonder how to customise the Combobox component in Flash . It's easy to change the skin. Simply double click the component , enter each movieclip and change the style. But ever wonder how to change text color and it's position.

I will try to point out step by step procedure for customise it.

1. First create a class which extends ComboBox. I used DropDownComboBox for class name.
2. Second create another class for Cell render which extends CellRenderer. I used DropDownCellRenderer;
3. Open a new flash document  and insert a combobox component in the stage.
4. Select ComboBox clip in the library. Right click on it and select Properties. 
5. In the properties panel change the default Class to the custom class you wrote . ie, DropDownComboBox 
6. Inside the DropSownComboBox constructer function type this code 

dropdown.setStyle('cellRenderer', DropDownCellRenderer);

7. If you need to change the Text of ComboBox type the below code
textFormat = new TextFormat(new Font2().fontName, 11, 0xCC3333);
textField.setStyle('embedFonts', true);
textField.setStyle('textFormat', textFormat); 
8. If you need to change the Text in dropDown cells  type this code inside the DropDownCellRenderer class
this.setStyle('embedFonts', true);
this.setStyle('textFormat', new TextFormat(new Font2().fontName, 11, 0x000000));

9. If you need to change the text positions override the drawLayout function 
override protected function drawLayout():void {
super.drawLayout()
textField.y += 10;
}

That's it . I have attached my code here. You can check it .


0 comments
1 comments

How to create key hash in Windows 7 64bit

Recently i tried to get started with Facebook SDK for Android . Actually there is a good tutorials for getting started in facebook developer site. I followed this link
https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

I created a sample app in Facebook developer site and added the key hash in App setting . but When started the app i found the Facebook Authentication is working at all.I got
 
Mobiletest is misconfigured for Facebook login. Press okay to go back to the application without connecting to facebook

If you press okay it will go back to the application. And it will show an error like
Login Failed: invalid_key: android key mismatch. Your key "abcdefghijklmns" Does not match tje allowed keys specified in your application Settings

This is because you have entered a wrong key in Apps settings in https://developers.facebook.com/apps.
After lot of googling i found that the keytool am using giving a wrong key hash. The error is caused by Openssl-for- windows library. Actually i downloaded the latest openssl-for-windows library from Google code. After more searching i found the latest library won't work fine in 64 bit windows. I will list out what i have done.

  1. First download openssl-0.9.8e_X64 (Note it's not the latest version. The latest version when am writing is openssl-0.9.8k_X64).
  2. Extract it . You will found libeay32.dll, ssleay32.dll and openssl.exe in bin folder. Copy it to C:\Windows\SysWOW64 (If it's added to path or Extract it somewhere and give the full path in command). 
  3. Use this comand 
  4. keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64
  5. use the password android 
  6. Copy and paste the 30 character key hash in Facebook
Now it's works fine for me.