Posted
Filed under C#

[원문] : http://www.csharphelp.com/2006/06/an-overview-of-link-label-in-c/

Introduction:

The LinkLabel control exhibits links to otherobjects, such as files or Web pages. Class LinkLabel is derived fromclass Label and therefore inherits all of class Label�s functionality.A LinkLabel looks as underlined text. When the mouse moves above thelink, the pointer modify to a hand. This is alike to the behavior of ahyperlink in a Web page. The link can change color to indicate whetherthe link is new, visited or active. When clicked, the LinkLabelgenerates a LinkClicked event.

Class LinkLabel :

Class LinkLabel is derived from class Label and therefore inherits all ofclass Label�s functionality. Hand image displays when mouse moves over LinkLabel.

Some common Properties of LinkLabel:

ActiveLinkColor – Denotes the color of the active link when clicked. Default is red.LinkColor – Denotes the original color of every links prior to they have been visited. Default is blue.
Links – Lists the LinkLabel Link objects, which are the links enclosed in the LinkLabel.
LinkVisited – If True, link appears as though it were visited (itscolor is changed to that specified by property VisitedLinkColor).
Text – Denotes the text to show on the control.
VisitedLinkColor – Denotes the color of visited links. Default is purple.
LinkArea – Denotes which part of text in the LinkLabel is treated as element of the link.
LinkBehavior – Denotes the link�s behavior, for example how the link come into view when the mouse is positioned over it.
LinkClicked – Generated when link is clicked.

Now let us see the usage of LinkLabel control with an example:
In this example I place a LinkLabel control with the text "To know C# -visit www.csharpheaven.com – Click Here!" and provide a link to aportion of the text. So that when clicked, the LinkLabel generates aLinkClicked event.

The Example:

using System;
using System.Drawing;
using System.ComponentModel;
using System.WinForms;
public class LinkLabel : System.WinForms.Form {
private System.WinForms.LinkLabel linkLabel1;

public LinkLabel() {

InitializeComponent();

}

public override void Dispose() {
base.Dispose();
}

public static void Main(string[] args) {
Application.Run(new LinkLabel());}
private void InitializeComponent()
{
this.linkLabel1 = new System.WinForms.LinkLabel();
linkLabel1.Text = "To know C# – visit www.csharpheaven.com – Click Here!";
linkLabel1.Size = new System.Drawing.Size(168, 56);
linkLabel1.LinkColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)128,(byte)255, (byte)255);
linkLabel1.LinkArea = new System.Drawing.Point(42, 11);
linkLabel1.ForeColor = System.Drawing.Color.Maroon;
linkLabel1.Font = new System.Drawing.Font("Times New Roman", 10f,
System.Drawing.FontStyle.Bold);
linkLabel1.TabIndex = 0;
linkLabel1.TabStop = true;
linkLabel1.Location = new System.Drawing.Point(8, 16);
linkLabel1.LinkClick += new System.EventHandler(linkLabel1_LinkClicked);
this.Controls.Add(linkLabel1);
this.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128);
}
protected void linkLabel1_LinkClicked(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("IExplore"," http://www.csharphelp.com");

}

}

Here the above program is written by hand (Adding LinkLabelcontrol to a form programmatically)

The program below is the code generated by the WINDES.exe.

// Win32Form1.cs
namespace Win32Form1Namespace {

using System;
using System.Drawing;
using System.ComponentModel;
using System.WinForms;

/// <summary>
/// Summary description for Win32Form1.
/// </summary>
public class Win32Form1 : System.WinForms.Form {

/// <summary>
/// Required by the Win Forms designer
/// </summary>
private System.ComponentModel.Container components;
private System.WinForms.LinkLabel linkLabel1;

public Win32Form1() {

// Required for Win Form Designer support
InitializeComponent();

// TODO: Add any constructor code after InitializeComponent call

}

/// <summary>
/// Clean up any resources being used
/// </summary>
public override void Dispose() {
base.Dispose();
components.Dispose();
}

/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args) {
Application.Run(new Win32Form1());
}

/// <summary>
/// Required method for Designer support – do not modify
/// the contents of this method with an editor
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.linkLabel1 = new System.WinForms.LinkLabel();

//@design this.TrayHeight = 0;
//@design this.TrayLargeIcon = false;
//@design this.TrayAutoArrange = true;
linkLabel1.Text = "To know C# – visit www.csharpheaven.com – Click Here!";
linkLabel1.Size = new System.Drawing.Size(184, 56);
linkLabel1.LinkColor = System.Drawing.Color.Teal;
linkLabel1.LinkArea = new System.Drawing.Point(42, 11);
linkLabel1.ForeColor = System.Drawing.Color.Maroon;
linkLabel1.Font =
new System.Drawing.Font("Times New Roman", 10f, System.Drawing.FontStyle.Bold);
linkLabel1.TabIndex = 0;
linkLabel1.DisabledLinkColor = System.Drawing.Color.Yellow;
linkLabel1.TabStop = true;
linkLabel1.Location = new System.Drawing.Point(8, 16);
linkLabel1.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)192, (byte)128);
linkLabel1.LinkClick += new System.EventHandler(linkLabel1_LinkClick);

this.Text = "Win32Form1";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.KeyPreview = true;
this.TransparencyKey = System.Drawing.Color.White;
this.BackColor =
(System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128);
this.ClientSize = new System.Drawing.Size(272, 149);
this.Click += new System.EventHandler(Win32Form1_Click);

this.Controls.Add(linkLabel1);
}
protected void Win32Form1_Click(object sender, System.EventArgs e)
{

}
protected void linkLabel1_LinkClick(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("IExplore", "http://www.csharphelp.com" );

linkLabel1.LinkVisited = true;
}

}
}

2010/04/06 20:18 2010/04/06 20:18
Posted
Filed under Htm&Javascript
[원문]  http://vincenthomedev.wordpress.com/2009/02/10/consuming-an-aspnet-web-service-or-page-method-using-jquery/



The following is a dummy ASP .NET web service. Please note that this service is adorned with the ScriptService attribute that makes it available to JavaScript clients.

Listing 2: A Dummy web service
  1. [WebService(Namespace = "http://tempuri.org/")]  
  2. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
  3. [System.Web.Script.Services.ScriptService]  
  4. public class dummyWebservice : System.Web.Services.WebService  
  5. {  
  6.   [WebMethod()]  
  7. public string HelloToYou(string name)  
  8.   {  
  9. return "Hello " + name;  
  10.   }  
  11.   [WebMethod()]  
  12. public string sayHello()  
  13.   {  
  14. return "hello ";  
  15.   }    

For example, we can call a specific web method in a web service as such.

Listing 4: JQuery .ajax command
  1.   $.ajax({  
  2.   type: "POST",  
  3.   contentType: "application/json; charset=utf-8",  
  4.   url: "WebService.asmx/WebMethodName",  
  5.   data: "{}",  
  6.   dataType: "json"
  7. }); 

Two things are worth noting in the above JQuery AJAX call. First, we must specify the contentType’s value as application/json; charset=utf-8, and the dataType as json; second, to make a GET request, we leave the data value as empty.

So put it together, the following code demonstrates how we would use JQuery to call the web service we created above.

Listing 5: Calling a web service using jQuery
  1. <%@ Page Language="C#" %>
  2. <%@ Import Namespace="System.Web.Services" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
  4. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html >
  6. <head id="Head1" runat="server">
  7. <title>ASP.NET AJAX Web Services: Web Service Sample Page</title>
  8. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jQuery/1.2.6/jQuery.min.js">
  9. </script>
  10. <script type="text/javascript">
  11.       $(document).ready(function() {  
  12.          $("#sayHelloButton").click(function(event){  
  13.              $.ajax({  
  14.                  type: "POST",  
  15.                  url: "dummyWebsevice.asmx/HelloToYou",  
  16.                  data: "{‘name’: ‘" + $(‘#name’).val() + "’}",  
  17.                  contentType: "application/json; charset=utf-8",  
  18.                  dataType: "json",  
  19.                  success: function(msg) {  
  20.                      AjaxSucceeded(msg);  
  21.                  },  
  22.                  error: AjaxFailed  
  23.              });  
  24.          });  
  25.      });  
  26.           function AjaxSucceeded(result) {  
  27.               alert(result.d);  
  28.           }  
  29.           function AjaxFailed(result) {  
  30.               alert(result.status + ‘ ‘ + result.statusText);  
  31.           }    
  32. </script>
  33. </head>
  34. <body>
  35. <form id="form1" runat="server">
  36. <h1> Calling ASP.NET AJAX Web Services with jQuery </h1>
  37.      Enter your name:   
  38. <input id="name" />
  39. <br />
  40. <input id="sayHelloButton" value="Say Hello"
  41. type="button" />
  42. </form>
  43. </body>
  44. </html>

Calling an ASP .NET page method

Listing 6: A dummy hello world page method

  1. [WebMethod()]  
  2. public static string sayHello()  
  3. {  
  4. return "hello ";  
  5. }   

Please note that page methods must be declared as static, meaning a page method is completely self-contained, and no page controls are accessible through the page method. For example, if you have a textbox on the web form, there is no way the page method can get or set its value. Consequently any changes with regards to the controls have no affect on the page method. It is stateless and it does not carry any of the view-state data typically carries around by an asp .NET page.

We use the same jQuery command $.ajax to call a page method, as shown in the following example.

  1. <script type="text/javascript">  
  2.       $(document).ready(function() {  
  3.           $.ajax({  
  4.               type: "POST",  
  5.               url: "pagemethod.aspx/sayHello",  
  6.               contentType: "application/json; charset=utf-8",  
  7.               data: "{}",  
  8.               dataType: "json",  
  9.               success: AjaxSucceeded,  
  10.               error: AjaxFailed  
  11.           });   
  12.     });  
  13. function AjaxSucceeded(result) {  
  14.           alert(result.d);  
  15.       }  
  16. function AjaxFailed(result) {  
  17.           alert(result.status + ‘ ‘ + result.statusText);  
  18.       }    
  19.   </script>   

For more info please visit Xun Ding’s excellent article Using jQuery with ASP .NET

2010/04/05 18:04 2010/04/05 18:04
Posted
Filed under C#
[원문] - http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=320

<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
Response.ContentType="application/zip";
Response.AppendHeader("Content-Disposition","attachment; filename=myzipfile.zip");
Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile.zip");
Response.Flush();
}
</script>

N.B. Reader Shaun College added the following to chop off the extra junk that may be sent by the ASP.NET runtime along with your file:

Response.AddHeader ("Content-Length", FileSize.ToString());
2010/04/02 09:18 2010/04/02 09:18
Posted
Filed under JSP, JAVA
[원문] - http://okjsp.tistory.com/1165643255

자바 설치한 디렉토리를 기억합니다. 복사하면 좋구요.
예를 들면
C:\java\jdk1.6.0_04

내 컴퓨터 클릭하고 alt+Enter를 누르면 속성창이 뜹니다.
거기서 "고급" 탭을 클릭하고 하단의 "환경 변수" 버튼을 클릭 합니다.

사용자와 시스템이 상하로 나오는데,
시스템 쪽에 하는 것이 좋습니다.
새로 만드는 환경변수는 "JAVA_HOME" 입니다.
아까 복사한 자바 디렉토리를 아래 붙여 놓습니다.
사용자 삽입 이미지

그리고 하나 더 손 봐야 됩니다.
시스템 쪽에 Path 환경변수가 보입니다.

이것 열고 Home 키를 눌러서 맨 앞으로 가서
%JAVA_HOME%\bin;
을 추가합니다.

확인은 말이죠.
cmd 창 띄우고, 까만 화면에서
echo %Path%
하면 됩니다.

그리고
java -version
하면 버전도 보이죠.
2010/03/22 15:47 2010/03/22 15:47
Posted
Filed under Action Script
[원문] http://www.flashmorgan.com/index.php/2007/12/20/ondragover-ondragout-and-onreleaseoutside-in-as3/

정확한 내용은 모르겠으나 .. 대충 살펴 보면 actionscript 2.0에서 onReleaseOutSide  사용했었다. 그러면 3.0에서는 api를 살펴보면 onReleaseOutSide 는 존재 하지 않는다.
구글 링 결과...
마우스 다운 이벤트 후 event.curentTarget 에 마우스 업 이벤트를 다시 걸어 준다.
drag area 밖에서 발생한 클릭 이벤트에 대해서는 부모가 반응 하여 동작 하게 된다.
그려면 다시 이벤트 타겟을 비교 하여 체크 할 수 있다.

drag 이벤트 구현중 swf player를 만드는데 응용해 봤다.

public function bar_pointerMouseDown(event:MouseEvent):void{
    drag=true;
    movie.movie.stop();
    event.currentTarget.startDrag(false,myRectangle);
    event.currentTarget.parent.stage.addEventListener(MouseEvent.MOUSE_UP, bar_progressMouseUp);
   }
     
   public function bar_progressMouseUp(event:MouseEvent):void{
   
    if(event.currentTarget!=control_progressbar.bar_pointer){
       trace("release outside");
    }else{
    }
    drag=false;
    control_progressbar.bar_pointer.parent.stage.removeEventListener(MouseEvent.MOUSE_UP,bar_progressMouseUp);
    control_progressbar.bar_pointer.stopDrag();
   }


[원문]

In AS2 there were three mouse events that I used quite often. onDragOver was thrown when the mouse button is selected and the cursor was moved over a MovieClip. This was useful to detect if another object was being dragged over a given clip. onDragOut was the opposite, this event was thrown when the mouse button was selected and the cursor was dragged outside of a given clip. And lastly, onReleaseOutside was thrown when a clip was pressed and the user dragged off the clip before releasing the mouse button. Releasing the mouse outside is a common way for a user to bail out of selecting a button among other reasons.

If you look through the AS3 documentation you will notice there are no MouseEvent.DRAG_OVER, MouseEvent.DRAG_OUT, or MouseEvent.RELEASE_OUTSIDE events. This does not mean that this functionality is not available, it’s just not as obvious. The following code shows how to recreate this functionality in AS3.

var button:Sprite = new Sprite();
button.graphics.beginFill(0x000000, 1);
button.graphics.drawRect(50,50,200,100);
addChild(button);

button.buttonMode = true;
button.addEventListener(MouseEvent.MOUSE_DOWN, buttonPress);
button.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
button.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
button.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);

function buttonPress(e:MouseEvent):void {
     //the button is pressed, set a MOUSE_UP event on the button's parent stage
     //to caputre the onReleaseOutside event.
     button.parent.stage.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
}

function buttonRelease(e:MouseEvent):void {
     //remove the parent stage event listener
     button.parent.stage.removeEventListener(MouseEvent.MOUSE_UP, buttonRelease);

     //if the events currentTarget doesn't equal the button we
     //know the mouse was released outside.
     if (e.currentTarget != button) {
          trace('onReleasedOutside');
     } else {
          //the events currentTarget property equals the button instance therefore
          //the mouse was released over the button.
          trace('onRelease');
     }
}

function buttonOver(e:MouseEvent):void {
     if (e.buttonDown) {
          //if the mouse button is selected when the cursor is
          //over our button trigger the onDragOver functionality
          trace('onDragOver');
     } else {
          //if the mouse button isn't selected trigger the standard
          //onRollOver functionality
          trace('onRollOver');
     }
}

function buttonOut(e:MouseEvent):void {
     if (e.buttonDown) {
          //if the mouse button is selected when the cursor is
          //moves off of our button trigger the onDragOut functionality
          trace('onDragOut');
     } else {
          //if the mouse button isn't selected trigger the standard
          //onRollOut functionality
          trace('onRollOut');
     }
}

So let me explain what is going on here.

To recreate the onDragOver and onDragOut functionality we use the buttonDown property of the MouseEvent. The buttonDown property is a Boolean value that indicates if the users mouse button is selected when the event was triggered. If this property is true we know the user is dragging over or dragging out of the button. If the buttonDown property is false we can trigger our standard rollOver or rollOut functionality.

Recreating the onReleaseOutside functionality is a trickier multi-step process. First we must set up a MouseEvent.MOUSE_DOWN event listener on the button. Secondly we set up a MouseEvent.MOUSE_UP event listener on the same button. Third, in the MouseEvent.MOUSE_DOWN event handler we set up another MouseEvent.MOUSE_UP event listener on the button’s stage that triggers the same event handler as the MouseEvent.MOUSE_UP event handler (buttonRelease) that is set on the button. And lastly we check the currentTarget property of the event passed into the MouseEvent.MOUSE_DOWN event handler to see if it equals the button or the button’s parent stage. If the currentTarget equals the button we know the mouse button was released over the button and we can trigger the onRelease functionality. If the currentTarget property isn’t the button we can assume the user released the mouse button outside of the button. Each situation is different, button.parent.stage may not work in your application, you may have to traverse up the display list, possibly right down to the root child (the Stage) to succesfully detect the onReleaseOutside event. Below I have updated the buttonDown method to show a simple way of traversing up the display list as far as you can go and setting the MouseEvent.MOUSE_UP on the root child.

function buttonPress(e:MouseEvent):void {
     //the button is pressed, set a MOUSE_UP event on the root child in the display list
     //to caputre the onReleaseOutside event.
     var rootChild:DisplayObject = button;
     while (rootChild.parent != null) {
          rootChild = rootChild.parent;
     }
     rootChild.stage.addEventListener(MouseEvent.MOUSE_UP, buttonRelease);
}
2010/03/19 16:48 2010/03/19 16:48
Posted
Filed under Action Script

[원문] - http://www.kirupa.com/forum/showpost.php?p=2108585&postcount=328


play , stop 을 컨트롤 하기 위해서는  별도의 클레스를 만들어서 대리자 역할을 하는 play와 ,stop() 메소드르 ㄹ활용하여 컨트롤 바와 동기화 할 수 있다.
그러나 얼마나 귀찮은 일인가...
action script 3.0에서는 movie를 exteds 하여 재정의 하여 사용 하면 해결 할 수 있다.

컨텐츠 파일에 아래와 같은 클래스를 등록 하고
Document class로 등록 하면,, swf가 실행 될 때 즉 movie를 기준으로 생성이 된다.
그러면 컨트롤 바에서무비가 stop()되는 것을 컨트롤 할 수 있다.

if (myMovie.isPlaying) {
myMovie.stop();
}
식으로...
체그 하면 될듯 ..




 
package {

import flash.display.MovieClip;

/**
* MovieClip class that adds an isPlaying property
* to indicate whether or not the movie clip is
* currently playing.  Have your classes extend this
* class instead of MovieClip or set this class as the
* Base class of your movie clip(s) in the library to
* have those instances gain the isPlaying property.
*/
public class MovieClipWithIsPlaying extends MovieClip {

/**
* Private property to internally keep track of whether or
* not the current movie clip is being played
*/
private var _isPlaying:Boolean = true;

/**
* Getter function creating a public, read-only isPlaying
* property allowing users to get but not set the _isPlaying
*  property to determine if the movie clip is playing
*/
public function get isPlaying():Boolean {
return _isPlaying;
}

/**
* Constructor
*/
public function MovieClipWithIsPlaying(){
super();
}

// override all timeline commands for movie clip that would
// affect the isPlaying property of the movie clip:

public override function gotoAndPlay(frame:Object, scene:String = null):void {
_isPlaying = true;
super.gotoAndPlay(frame, scene);
}

public override function gotoAndStop(frame:Object, scene:String = null):void {
_isPlaying = false;
super.gotoAndStop(frame, scene);
}

public override function nextFrame():void {
_isPlaying = false;
super.nextFrame();
}

public override function nextScene():void {
_isPlaying = true;
super.nextScene();
}

public override function play():void {
_isPlaying = true;
super.play();
}

public override function prevFrame():void {
_isPlaying = false;
super.prevFrame();
}

public override function prevScene():void {
_isPlaying = true;
super.prevScene();
}

public override function stop():void {
_isPlaying = false;
super.stop();
}
}
}

2010/03/18 22:42 2010/03/18 22:42
Posted
Filed under 웹표준
[원문] - http://hylaweb.net/guide/html/04_image/image03.php

PNG-24 사용 가이드

png 이미지를 사용시 ie6에서 배경이 회색으로 보이는 현상이 있습니다.
많이 알려진 htc 로는 no-repeat 이되서 배경을 원하는 위치에 두거나 반복적인 효과를 줄수없습니다.
iepngfix.htc와 iepngfix.js 를 이용해 ie6에서도 정상적이게 보일수있게 합니다.

첨부파일

출처 : http://www.twinhelix.com/css/iepngfix/ 새창

ie6 이하의 버전을 위한 핵이므로 css 는 따로 해주시는게 좋습니다.

샘플1. png 이미지를 <img>로 사용

코드뷰
<style type="text/css">
#sample01 {width:200px; height:100px; background:#333;}
.png24 {behavior:url(iepngfix/iepngfix.htc)}
</style>

<div id="sample01">
<img src="img/text.png" class="png24" alt="" />
</div>

샘플2. png 이미지를 배경으로 사용 (고정배경으로 사용시는 htc와 js 필요없이 filter를 쓰시면됩니다.)

코드뷰
<style type="text/css">
#sample02 {width:200px; height:100px; background:#ddd url(img/text.png) no-repeat;}
</style>
<!--[if lt ie 7]>
<style type="text/css">
#sample02 {background:#ddd; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/text.png', sizingMethod='crop');}
</style>
<![endif]-->

<div id="sample02">
</div>

샘플3. png 이미지를 배경으로 반복(repeat) 또는 위치지정

코드뷰
<script type="text/javascript" src="iepngfix/iepngfix.js"></script>

<style type="text/css">
#sample03 {width:200px; height:100px; background:#ddd url(img/text.png) repeat-y;}
</style>
<!--[if lt ie 7]>
<style type="text/css">
#sample03 {background:#ddd url(img/text.png) repeat-y; behavior:url(iepngfix/iepngfix.htc);}
</style>
<![endif]-->

<div id="sample03">
<img src="img/text.png" class="png24" alt="" />
</div>
2010/03/18 13:18 2010/03/18 13:18
Posted
Filed under Action Script

[원문]  - http://theolagendijk.wordpress.com/2007/07/06/parameters-for-a-flash-9-actionscript-3-swf/

Recently I wrote a blog post about the differences between ActionScript 3.0 and ActionScript 2.0. One major difference that I found and dealt with had been lost in my unordered notes of what I wanted to write about;

Passing parameters to Flash.
Why would you want to that? Consider the case that your website consists of one giant swf file (and there are valuable reasons to have such a website). Off course the swf will probably be embedded inside a HTML page that links the swf content to some meta data and offers some alternative HTML content for the visitor that have no Flash plugin for their browser, but the content that you want to show to the visitor is all trapped inside that swf file. If for example you had blog content inside that swf, it would kind of suck that you have no means for giving friends URLs to directly jump to a specific blog post inside that swf similar to what you achieve with permalinks in HTML blogs. (I can for example give people the hyperlinks to blogging-in-flash or findability-and-linkability-with-flash to directly point them to what I want them to read about.) And this is just one example of why you would want a way of “indexing your swf”/”generate your swf based on parameters”.

So here it is then. A short explanation of implementing parameter passing to an ActionScript 3.0 swf. It still is as simple as having your browser request the swf file with extra parameters folowing the name of the file. Like this; name_of_your.swf?param1=value1&param2=value2&param3=value3 etc… this part hasn’t changed. But getting access to the passed parameters has. In ActionScript 2 you used to have global access to the parameters as they where added as variables to the _root namespace. Now it’s slightly different, they’re now stored in the loaderInfo of the Stage object. (So it’s only accessible from the Stage object itself or members of it’s display tree.
Here’s example code reading the variables;

var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
//do something with this information
}

Something else
There’s something else that slightly touches this subject. Use the Adobe Flash Player version detection kit. The flash 9 player is taken over the old players but not everyone is having the new player yet. Be sure to detect this and gently notify your visitors of the need to update their Flash plugin. That’s so much better then seeing nothing or an incorrectly functioning website! The kit provides of examples of it’s use but it might confuse you of where to insert the Flash parameters into the JavaScript function call that generates the embedded Flash object. Just add the parameters in the src string tuple (’src’, ‘your_swf_location‘), you can omit the .swf file extension here.

For example this is the javascript (generated from a server side script) function call that embeds the Studio Roosegaarde 2.0 swf with parameter blog_item(=15);

if(hasRightVersion) { // if we’ve detected an acceptable version
// embed the flash movie
AC_FL_RunContent(
‘width’, ‘100%’,
‘height’, ‘100%’,
src‘, ‘StudioRoosegaarde2?blog_item=15‘,
‘quality’, ‘best’,
‘pluginspage’, ‘http://www.macromedia.com/go/getflashplayer’,
‘name’, ‘StudioRoosegaarde2′,
‘allowScriptAccess’,’sameDomain’,
‘allowFullScreen’,'true’
); //end AC code
}

2010/03/15 16:19 2010/03/15 16:19
Posted
Filed under JSP, JAVA
[원문] - http://mwultong.blogspot.com/2006/11/java-mathrandom-int.html
Random 클래스 없이, 간단히 정수 난수 구하기 예제
public class Foo {
  public static void main(String[] args) {


    // 0.0 ~ 1.0 사이의 실수 난수 구하기
    for (int i = 1; i <= 20; i++)
      System.out.println(Math.random());

/* 출력 결과:
0.8835488755737285
0.7442235907969202
0.04143887519495115
0.7752670113987891
0.525644276817284
0.9810655979902362
0.9857864655525691
0.5176456441171947
0.9534154184106848
0.5711598917262706
0.9167881479510426
0.9683895991289863
0.5570482364156645
0.640266931881892
0.7521635329694171
0.37944742406283405
0.1930044225804538
0.6713601888567906
0.28656122448550325
0.9697966362643208
*/




    // 1 ~ 10 까지의 정수 난수 구하기
    for (int i = 1; i <= 20; i++) {
      int n = (int) (Math.random() * 10) + 1;
      System.out.println(n);
    }

/* 출력 결과:
8
4
2
2
7
1
3
7
10
3
7
2
10
8
3
5
4
10
4
1
*/


  }
}
2010/03/11 19:08 2010/03/11 19:08