Do you want to buy me a beer or coffee?

Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Wednesday, February 10, 2010

How to use the UIScrollBar component in Flash

http://flashexplained.com/basics/how-to-use-the-uiscrollbar-component-in-flash/

How to use the UIScrollBar component in Flash


October 11th, 2008 | Author: Luka | Category: Basics
In this easy and detailed Flash lesson, I will show you how to use the scrollbar component that it is ready-made for use in Flash. This can save you a lot of coding — why create a scrollbar from scratch when you have one at your disposal? You will learn the following:

How to set up a dynamic text field,
How to display text in a dynamic text field via some really simple ActionScript code,
How to set up an instance of the UIScrollBar component and link it to your text field and more.
Below is a live Flash example that displays a text field with a scrollbar attached next to it. Try pressing the up and down arrow buttons on the scrollbar or clicking the scroller and dragging it up and down. The text inside the field will scroll flawlessly.

http://flashexplained.com/basics/how-to-use-the-uiscrollbar-component-in-flash/

Friday, December 11, 2009

Interaction Between Flash and Javascript

<!--

function getFlashMovieObject(movieName)

{

if (window.document[movieName])

{

return window.document[movieName];

}

if (navigator.appName.indexOf("Microsoft Internet")==-1)

{

if (document.embeds && document.embeds[movieName])

return document.embeds[movieName];

}

else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)

{

return document.getElementById(movieName);

}

}

function StopFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.StopPlay();

}

function PlayFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Play();

//embed.nativeProperty.anotherNativeMethod();

}

function RewindFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Rewind();

}

function NextFrameFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

// 4 is the index of the property for _currentFrame

var currentFrame=flashMovie.TGetProperty("/", 4);

var nextFrame=parseInt(currentFrame);

if (nextFrame>=10)

nextFrame=0;

flashMovie.GotoFrame(nextFrame);

}

function ZoominFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Zoom(90);

}

function ZoomoutFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Zoom(110);

}

function SendDataToFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.SetVariable("/:message", document.controller.Data.value);

}

function ReceiveDataFromFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

var message=flashMovie.GetVariable("/:message");

document.controller.Data.value=message;

}

//-->

Wednesday, December 9, 2009

Three Options for Making Asynchronous Calls

Three Options for Making Asynchronous Calls

Every application is different, and there are scenarios for making asynchronous calls that work for some applications that may not work for others. The .NET Framework is quite flexible in the ways that it provides for making asynchronous calls. You can either poll to see when a request completes, block on the WaitHandle, or wait for the callback function. Let's take a look at each of these approaches.

' Polling code that could tie up your processor

Dim proxy as New localhost.Service1()
Dim result as IAsyncResult Result = proxy.BeginDelayedResponse(2000, _ Nothing, _ Nothing)
While (result.IsCompleted = False)
' Do some processing ...
Wend
Dim response as String response = proxy.EndDelayedResponse(result)


' Simple WaitHandle code
Dim proxy As New localhost.Service1()
Dim result As IAsyncResult
result = proxy.BeginDelayedResponse(2000, Nothing, Nothing)
' Do some processing.
' ...
' Done processing. Wait for completion.
result.AsyncWaitHandle.WaitOne()
Dim response As String
response = proxy.EndDelayedResponse(result)


' Simple callback code
Dim proxy As localhost.Service1
Private Delegate Sub LabelDelegate( _
ByVal responseLabel As Label, _
ByVal response As String)

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button7.Click
proxy = New localhost.Service1()
ClearForm()
Dim r As New Random()

proxy.BeginDelayedResponse(r.Next(1, 10000), _
New AsyncCallback(AddressOf Me.ServiceCallback), _
Label1)
proxy.BeginDelayedResponse(r.Next(1, 10000), _
New AsyncCallback(AddressOf Me.ServiceCallback), _
Label2)
proxy.BeginDelayedResponse(r.Next(1, 10000), _
New AsyncCallback(AddressOf Me.ServiceCallback), _
Label3)
End Sub

Private Sub ServiceCallback(ByVal result As IAsyncResult)
Dim response As String
response = proxy.EndDelayedResponse(result)
Dim responseLabel As Label = result.AsyncState
responseLabel.Invoke( _
New LabelDelegate(AddressOf Me.DisplayResponses), _
New Object() {responseLabel, response})
End Sub

Private Sub DisplayResponses(ByVal responseLabel As Label, _
ByVal response As String)
responseLabel.Text = response
Form1.ActiveForm.Refresh()
End Sub


reference: http://msdn.microsoft.com/en-us/library/aa480512.aspx


Windows LiveT Hotmail is faster and more secure than ever. Learn more.

Tuesday, March 31, 2009

what's different between padding and margin


Margins and padding can be confusing to the novice Web designer. After all, in some ways, they seem like the same thing: white space around an image or object.

Padding is the space inside the border between the border and the actual image or cell contents. In the image, the padding is the yellow area around the contents. Note that padding goes completely around the contents: there is padding on the top, bottom, right and left sides.

Margins are the spaces outside the border, between the border and the other elements next to this object. In the image, the margin is the red area outside the entire object. Note that, like the padding, the margin goes completely around the contents: there are margins on the top, bottom, right, and left sides.

Thursday, March 5, 2009

javascript 4 add to favorite Or bookmark

<script language="JavaScript1.2" type="text/javascript">
function CreateBookmarkLink() {
title = "ttNotes - Hot Spot";
url = "Http://ttNotes.blogspot.com/";

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title);
} else if(window.opera && window.print) { // Opera Hotlist
alert("Please Click [Ctrl + T] or [apple + T]");
} else { // Opera Hotlist
alert("Please Click [Ctrl + D] or [apple + D]");
}
}

if (window.external) {
document.write('<a href = "javascript:CreateBookmarkLink();">Add to Favorites</a>');
} else if (window.sidebar) {
document.write('<a href = "javascript:CreateBookmarkLink();">Bookmark Page</a>');
} else if (window.opera && window.print) {
document.write('<a href = "javascript:CreateBookmarkLink();">Add Bookmark</a>');
}
</script>

unfortunately, as far as we all know, the Bookmark functionality in FF can only be accessed through the window.sidebar element - i.e. we actually have to add the bookmark to FF’s sidebar…making it a pseudo bookmark really. I’ve looked around quite a bit on the subject and cannot find any documentation saying otherwise, so if you find something to the contrary I’d love to know about it.

But you can manually fix it. Right click on the bookmark and select “properties.” There’s an option for “Load this bookmark in the sidebar.” If you check that button, every time you click on that bookmark, it will open up in your sidebar.

if you uncheck the option, it will open the page in firefox main frame.


Tuesday, March 3, 2009

little trick: how to resize the background image?

As you found out, it is not possible to resize background-images (nor
'size-to-fit') with CSS 2.1.
There are plans to introduce in CSS 3, but that is still only at a
draft level. No browser support this (of course).

but we have little trick to resize the background image. if not for whole page. then need some with js script. go search "jquery.js" and "resize background image" with google

<img id="background-img" class="bg" src="yourimagename.jpg" alt="" />
.bg {
width: 100%;
height:*;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}

Tuesday, February 10, 2009

Safari Web developer tools


Safari provides advanced debugging tools for web developers. By default, it turns off. You can turn it on by paste this command (defaults write com.apple.Safari IncludeDebugMenu 1) into Terminal. You can use additional functionality like the JavaScript console, Web Inspector, and spoof Internet Explorer.


it's not good as other developer tools for IE and Firefox. it can not inspect dynamic items
correct me if I was wrong

google search 'Safari,"developer tools", Inspector'
.

Thursday, February 5, 2009

URL Encode and Decode for Classic ASP

URLDecode
For some reason, Microsoft did not include a URL decode function with Active Server Pages. Most likely, this was because the decoding of querystring variables is done automatically for you when you access the querystring object:


' -----------------------------------------
' URL decode to retrieve the original value

Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = ""
Exit Function
End If

' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+", " ")

' next convert %hexdigits to the character
aSplit = Split(sOutput, "%")

If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If

URLDecode = sOutput
End Function


Server.HTMLEncode
This useful built-in function is very useful for encoding text that should be displayed in a form input. By "form input" we mean a web form control such as a text input, select or textarea control.

You may have noticed that certain characters cause the HTML on your web form to be interpretted incorrectly. Specifically, the HTML tag characters "<" and ">" can have this effect as well as the quote character (") which is used to encapsulate values.

Server.HTMLEncode(sValue)

HTMLDecode
Just like with the URLDecode function described previously, Microsoft, in its infinite wisdom decided not to include an HTMLDecode function with their Server component. It is a relatively simple matter to decode this test data (although I haven't had a need to do this so far.) For completeness sake, here is an HTMLDecode function you may use:

Function HTMLDecode(sText)
Dim I
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "<" , Chr(60))
sText = Replace(sText, ">" , Chr(62))
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function

Wednesday, January 28, 2009

Varchar(max) and NVarchar(max)

Varchar(max) size limit in SQL 2005 is 2^31-1 bytes or 2,147,483,648 bytes. I haven't test the limit yet. According to MSN "Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes".

NVarchar(max) in SQL 2005 is 4000 characters.



SQL 2005

test page


templates for google search


<a class="afbutton" href="javascript:void(0)" onclick="javascript:submitgoogleSearch('hello world google search')" > &nbsp; google search 'hello world google search' &nbsp; </a>

will be shown as below

  google search 'hello world google search'  

Tuesday, January 27, 2009

XHTML Sample code -- An HTML document with a doctype of XHTML 1.0 Transitional:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Title of the document&gy;/title>
</head>

<body>
The content of the document......
</body>

</html>
<--nothing-->