1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.11 $ -->
<reference id="ref.ming">
<title>Flash 用 Ming 関数</title>
<titleabbrev>Ming (flash)</titleabbrev>
<partintro>
&warn.experimental;
<sect1 id="ming.intro">
<title>導入</title>
<simpara>
Ming は、SWF("Flash")フォーマットのムービーを作成するためのオープ
ンソース(LGPL)のライブラリです。Ming は、シェープ、グラディエント、
ビットマップ(PNGおよびJPEG)、モーフィング、テキスト、ボタン、アク
ション、スプライト("ムービークリップ")、mp3 のストリーム出力、色
変換といったFlash 4の機能のほとんど全てをサポートしています。現在、
未サポートなのは、サウンド関係のイベントのみです。
</simpara>
<simpara>
Ming は、短縮語ではありません。
</simpara>
<simpara>
長さ、距離、大きさ等を指定する値は全て "twips" つまり、20ユニット
/ピクセル単位であることに注意して下さい。しかし、実際には、Flash
プレイヤーがムービーをembed/object タグで指定したピクセルサイズま
たはembedされていない場合はフレーム全体にスケーリングするため、任
意のサイズになります。
</simpara>
<simpara>
Ming は、既存の PHP/libswf モジュールに対して多くの点で優れていま
す。Ming は、そのコードをコンパイルできる環境でならどこでも使用す
ることが可能です。一方、libswf のソースコードは公開されておらず、
ごくわずかなプラットフォームでのみ利用可能です。Windowsは、libswf
でサポートされるプラットフォームには入っていません。Ming は、ムー
ビーの要素をPHPオブジェクト内に隠蔽することにより、SWFファイルフォー
マットの細部を直接取り扱うことを回避しています。また、Ming はメン
テナンスが継続されています。使用したい機能がある場合には、我々、
<ulink url="mailto:&email.ming;">&email.ming;</ulink> まで知らせ
て下さい。
</simpara>
<simpara>
Ming は、PHP 4.0.5 で追加されました。
</simpara>
</sect1>
<sect1 id="ming.install">
<title>インストール</title>
<para>
Ming を PHP で使用するには、まず、Ming ライブラリを構築し、インス
トールする必要があります。ソースコードとインストール手引が、Ming
のホームページ <ulink url="&url.ming;">&url.ming;</ulink> から入
手可能です。ここには、例や簡単なチュートリアル、最新のニュースも
あります。
</para>
<para>
ming のアーカイブをダウンロードし、展開して下さい。Ming ディレク
トリに移動し、make、make install を実行して下さい。
</para>
<para>
これにより、<filename>libming.so</filename> が構築され、
<filename>/usr/lib/</filename> にインストールされます。また、
<filename>ming.h</filename> が <filename>/usr/include/</filename>
にコピーされます。インストールされるディレクトリを変更するには、
<filename>Makefile</filename> の <literal>PREFIX=</literal> の行
を編集して下さい。
</para>
<sect2 id="ming.install.php.unix">
<title>PHP (unix) に組み込む</title>
<para>
<informalexample>
<literallayout>
<![CDATA[
mkdir <phpdir>/ext/ming
cp php_ext/* <phpdir>/ext/ming
cd <phpdir>
./buildconf
./configure --with-ming <other config options>
]]>
</literallayout>
</informalexample>
PHP を通常と同様に構築、インストールして下さい。必要ならば Web
サーバを再起動して下さい。
</para>
</sect2>
<sect2 id="ming.install.php_module.unix">
<title>PHP モジュールをインストールする (unix)</title>
<para>
<filename>php_ming.so.gz</filename> をダウンロードして下さい。こ
れを解凍し、PHPモジュール用ディレクトリにコピーして下さい。
(PHPモジュール用ディレクトリは、<command>php-config
--extension-dir</command> を実行することにより見つけられます。
ここで、<literal>extension=php_ming.so</literal> を
<filename>php.ini</filename> ファイルに追加するか、
<literal>dl('php_ming.so');</literal> を全ての Ming スクリプトの
先頭に追加して下さい。
</para>
</sect2>
</sect1>
<sect1 id="ming.use">
<title>Mingの使用法</title>
<simpara>
Ming は、PHP に13個の新規オブジェクトを追加します。これらは全て、
メソッドと属性を有しています。これらを使用するには、<link
linkend="language.oop">オブジェクト</link> について知る必要があり
ます。
</simpara>
<itemizedlist>
<listitem>
<simpara>
<function>swfmovie</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfshape</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfdisplayitem</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfgradient</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfbitmap</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swffill</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfmorph</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swftext</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swffont</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swftextfield</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfsprite</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfbutton</function>.
</simpara>
</listitem>
<listitem>
<simpara>
<function>swfaction</function>.
</simpara>
</listitem>
</itemizedlist>
</sect1>
</partintro>
<refentry id='function.ming-setcubicthreshold'>
<refnamediv>
<refname>ming_setcubicthreshold</refname>
<refpurpose>
Set cubic threshold (?)
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>ming_setcubicthreshold</methodname>
<methodparam><type>int</type><parameter>threshold</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.ming-setscale'>
<refnamediv>
<refname>ming_setscale</refname>
<refpurpose>
Set scale (?)
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>ming_setscale</methodname>
<methodparam><type>int</type><parameter>scale</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.ming-useswfversion'>
<refnamediv>
<refname>ming_useswfversion</refname>
<refpurpose>
Use SWF version (?)
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>ming_useswfversion</methodname>
<methodparam><type>int</type><parameter>version</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.swfbutton-keypress'>
<refnamediv>
<refname>swfbutton_keypress</refname>
<refpurpose>
Returns the action flag for keyPress(char)
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>swfbutton_keypress</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<!-- SWFMovie -->
<refentry id="function.swfmovie">
<refnamediv>
<refname>SWFMovie</refname>
<refpurpose>
SWFバージョン4ムービー形式で新規ムービーオブジェクトを作成する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfmovie</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie</function> は、SWFバージョン4ムービー形式で新た
にムービーオブジェクトを作成します。
</para>
<simpara>
SWFMovie には、次のようなメソッドがあります。
<function>swfmovie->output</function>,<function>swfmovie->save</function>,
<function>swfmovie->add</function>,
<function>swfmovie->remove</function>,
<function>swfmovie->nextframe</function>,
<function>swfmovie->setbackground</function>,
<function>swfmovie->setrate</function>,
<function>swfmovie->setdimension</function>,
<function>swfmovie->setframes</function>,
<function>swfmovie->streammp3</function>
</simpara>
<simpara>
<function>swfdisplayitem->rotateto</function>,
<function>swfshape->setline</function>,
<function>swfshape->addfill</function> 等の例も参照下さい。
これらの例は全てこのオブジェクトを使用しています。
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfmovie.output">
<refnamediv>
<refname>SWFMovie->output</refname>
<refpurpose>作成したムービーを出力する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->output</methodname>
<void/>
</methodsynopsis>
<para>
<function>swfmovie->output</function> は、作成したムービーを出力
します。PHP では、この前に次のコマンドを実行することにより、ブラ
ウザにflashムービーが出力されます。
<programlisting role="php">
<![CDATA[
<?php
header('Content-type: application/x-shockwave-flash');
?>
]]>
</programlisting>
</para>
<simpara>
<function>swfmovie->save</function> も参照下さい。
</simpara>
<simpara>
<function>swfmovie->streammp3</function>,
<function>swfdisplayitem->rotateto</function>,
<function>swfaction</function> 等の例も参照下さい。全ての例は、こ
のメソッドを使用しています。
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfmovie.save">
<refnamediv>
<refname>SWFMovie->save</refname>
<refpurpose>ムービーをファイルに保存する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->save</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->save</function> は、ムービーを
<parameter>filename</parameter> という名前のファイルに保存します。
</para>
<simpara>
<function>output</function> も参照下さい。
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfmovie.add">
<refnamediv>
<refname>SWFMovie->add</refname>
<refpurpose>ムービーにデータ型を追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->add</methodname>
<methodparam><type>ressource</type><parameter>instance</parameter></methodparam>
</methodsynopsis>
<para>
<function>swfmovie->add</function> は、
<parameter>instance</parameter> をカレントのムービーに追加します。
<parameter>instance</parameter> は、次の型のデータのどれかとなり
ます。shapes, text, fonts, 等。ムービーで動作させたいものは、全て
追加する必要があります。
</para>
<para>
表示可能な型 (shape, text, button, sprite)の場合、このメソッドは、
表示リスト内のオブジェクトへのハンドル
<function>SWFDisplayItem</function> を返します。つまり、同じシェー
プをムービーに複数回追加することができ、各インスタンスについて異
なったハンドルを得ることが可能です。
</para>
<simpara>
(後述の)他の全てのオブジェクトに関する記述および
<function>swfmovie->remove</function> も参照下さい。
</simpara>
<simpara>
<function>swfdisplayitem->rotateto</function> および
<function>swfshape->addfill</function> の例も参照下さい。
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfmovie.remove">
<refnamediv>
<refname>SWFMovie->remove</refname>
<refpurpose>
表示リストからオブジェクトのインスタンスを削除する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->remove</methodname>
<methodparam><type>ressource</type><parameter>instance</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->remove</function> は、表示リストからオブジェ
クトのインスタンス <parameter>instance</parameter>を削除します。
</para>
<simpara>
<function>swfmovie->add</function> も参照下さい。
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfmovie.setbackground">
<refnamediv>
<refname>SWFMovie->setbackground</refname>
<refpurpose>背景色を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->setbackground</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->setbackground</function>は背景色を設定します。
Why is
there no rgba version? Think about it. (Actually, that's not such a dumb
question after all- you might want to let the html background show through.
There's a way to do that, but it only works on IE4. Search the
<ulink url="&url.macromedia;">&url.macromedia;</ulink> site for
details.)
</para>
</refsect1>
</refentry>
<refentry id="function.swfmovie.setrate">
<refnamediv>
<refname>SWFMovie->setrate</refname>
<refpurpose>アニメーションのフレームレートを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->setrate</methodname>
<methodparam><type>int</type><parameter>rate</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>nom_de_la_fonction</function> sets the frame rate to
<parameter>rate</parameter>, in frame per seconds.
Animation will slow down if the player can't render frames fast enough- unless
there's a streaming sound, in which case display frames are sacrificed to
keep sound from skipping.
</para>
</refsect1>
</refentry>
<refentry id="function.swfmovie.setdimension">
<refnamediv>
<refname>SWFMovie->setdimension</refname>
<refpurpose>ムービーの幅と高さを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->setdimension</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
<methodparam><type>int</type><parameter>height</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->setdimension</function> は、ムービーの幅を
<parameter>width</parameter> に、高さを
<parameter>height</parameter>に設定します。
</para>
</refsect1>
</refentry>
<refentry id="function.swfmovie.setframes">
<refnamediv>
<refname>SWFMovie->setframes</refname>
<refpurpose>アニメーションの総フレーム数を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->setframes</methodname>
<methodparam><type>string</type><parameter>numberofframes</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->setframes</function> sets the total number of frames
in the animation to <parameter>numberofframes</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfmovie.nextframe">
<refnamediv>
<refname>SWFMovie->nextframe</refname>
<refpurpose>アニメーションの次フレームに移動</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->nextframe</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->setframes</function> moves to the next frame of
the animation.
</para>
</refsect1>
</refentry>
<refentry id="function.swfmovie.streammp3">
<refnamediv>
<refname>SWFMovie->streammp3</refname>
<refpurpose>MP3 ファイルへのストリーム</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfmovie->streammp3</methodname>
<methodparam><type>string</type><parameter>mp3FileName</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmovie->streammp3</function> streams the mp3 file
<parameter>mp3FileName</parameter>. Not very robust in dealing with
oddities (can skip over an initial ID3 tag, but that's about it).
Like <function>SWFShape->addJpegFill</function>, this isn't a stable function- we'll
probably need to make a separate SWFSound object to contain sound types.
</para>
<para>
Note that the movie isn't smart enough to put enough frames in to contain
the entire mp3 stream- you'll have to add (length of song * frames per second)
frames to get the entire stream in.
</para>
<para>
Yes, now you can use ming to put that rock and roll devil worship music
into your SWF files. Just don't tell the RIAA.
<example>
<title><function>swfmovie->streammp3</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new SWFMovie();
$m->setRate(12.0);
$m->streamMp3("distortobass.mp3");
// use your own MP3
// 11.85 seconds at 12.0 fps = 142 frames
$m->setFrames(142);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- SWFDisplayItem -->
<refentry id="function.swfdisplayitem">
<refnamediv>
<refname>SWFDisplayItem</refname>
<refpurpose>新規に displayitem オブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfdisplayitem</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem</function> creates a new swfdisplayitem object.
</para>
<para>
Here's where all the animation takes place. After you define a shape,
a text object, a sprite, or a button, you add it to the movie, then use
the returned handle to move, rotate, scale, or skew the thing.
</para>
<simpara>
SWFDisplayItem has the following methods : <function>swfdisplayitem->move</function>,
<function>swfdisplayitem->moveto</function>, <function>swfdisplayitem->scaleto</function>,
<function>swfdisplayitem->scale</function>, <function>swfdisplayitem->rotate</function>,
<function>swfdisplayitem->rotateto</function>, <function>swfdisplayitem->skewxto</function>,
<function>swfdisplayitem->skewx</function>, <function>swfdisplayitem->skewyto</function>
<function>swfdisplayitem->skewyto</function>, <function>swfdisplayitem->setdepth</function>
<function>swfdisplayitem->remove</function>, <function>swfdisplayitem->setname</function>
<function>swfdisplayitem->setratio</function>, <function>swfdisplayitem->addcolor</function>
et <function>swfdisplayitem->multcolor</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.moveto">
<refnamediv>
<refname>SWFDisplayItem->moveTo</refname>
<refpurpose>グローバル座標系でオブジェクトを移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->moveto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->moveto</function> moves the current object to
(<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->move</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.move">
<refnamediv>
<refname>SWFDisplayItem->move</refname>
<refpurpose>オブジェクトを相対座標系で移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->move</methodname>
<methodparam><type>int</type><parameter>dx</parameter></methodparam>
<methodparam><type>int</type><parameter>dy</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->move</function> moves the current object by
(<parameter>dx</parameter>,<parameter>dy</parameter>) from its
current position.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->moveto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.scaleto">
<refnamediv>
<refname>SWFDisplayItem->scaleTo</refname>
<refpurpose>グローバル座標系でオブジェクトを拡大縮小する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->scaleto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->scaleto</function> scales the current object to
(<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->scale</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.scale">
<refnamediv>
<refname>SWFDisplayItem->scale</refname>
<refpurpose>相対座標系でオブジェクトを拡大縮小する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->scale</methodname>
<methodparam><type>int</type><parameter>dx</parameter></methodparam>
<methodparam><type>int</type><parameter>dy</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->scale</function> scales the current object by
(<parameter>dx</parameter>,<parameter>dy</parameter>) from its
current size.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->scaleto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.rotateto">
<refnamediv>
<refname>SWFDisplayItem->rotateTo</refname>
<refpurpose>グローバル座標系でオブジェクトを回転する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->rotateto</methodname>
<methodparam><type>float</type><parameter>degrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->rotateto</function> set the current object
rotation to <parameter>degrees</parameter> degrees in global coordinates.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<para>
This example bring three rotating string from the background to the
foreground. Pretty nice.
<example>
<title><function>swfdisplayitem->rotateto</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$thetext = "ming!";
$f = new SWFFont("Bauhaus 93.fdb");
$m = new SWFMovie();
$m->setRate(24.0);
$m->setDimension(2400, 1600);
$m->setBackground(0xff, 0xff, 0xff);
// functions with huge numbers of arbitrary
// arguments are always a good idea! Really!
function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string)
{
global $f, $m;
$t = new SWFText();
$t->setFont($f);
$t->setColor($r, $g, $b, $a);
$t->setHeight(960);
$t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2);
$t->addString($string);
// we can add properties just like a normal php var,
// as long as the names aren't already used.
// e.g., we can't set $i->scale, because that's a function
$i = $m->add($t);
$i->x = $x;
$i->y = $y;
$i->rot = $rot;
$i->s = $scale;
$i->rotateTo($rot);
$i->scale($scale, $scale);
// but the changes are local to the function, so we have to
// return the changed object. kinda weird..
return $i;
}
function step($i)
{
$oldrot = $i->rot;
$i->rot = 19*$i->rot/20;
$i->x = (19*$i->x + 1200)/20;
$i->y = (19*$i->y + 800)/20;
$i->s = (19*$i->s + 1.0)/20;
$i->rotateTo($i->rot);
$i->scaleTo($i->s, $i->s);
$i->moveTo($i->x, $i->y);
return $i;
}
// see? it sure paid off in legibility:
$i1 = text(0xff, 0x33, 0x33, 0xff, 900, 1200, 800, 0.03, $thetext);
$i2 = text(0x00, 0x33, 0xff, 0x7f, -560, 1200, 800, 0.04, $thetext);
$i3 = text(0xff, 0xff, 0xff, 0x9f, 180, 1200, 800, 0.001, $thetext);
for($i=1; $i<=100; ++$i)
{
$i1 = step($i1);
$i2 = step($i2);
$i3 = step($i3);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<simpara>
See also <function>swfdisplayitem->rotate</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.rotate">
<refnamediv>
<refname>SWFDisplayItem->Rotate</refname>
<refpurpose>相対座標系で回転する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->rotate</methodname>
<methodparam><type>float</type><parameter>ddegrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->rotate</function> rotates the current object
by <parameter>ddegrees</parameter> degrees from its current rotation.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->rotateto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.skewxto">
<refnamediv>
<refname>SWFDisplayItem->skewXTo</refname>
<refpurpose>X-skewを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->skewxto</methodname>
<methodparam><type>float</type><parameter>degrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->skewxto</function> sets the
x-skew to <parameter>degrees</parameter>. For <parameter>degrees</parameter>
is 1.0, it means a 45-degree forward slant. More is more forward,
less is more backward.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->skewx</function>,
<function>swfdisplayitem->skewy</function> and
<function>swfdisplayitem->skewyto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.skewx">
<refnamediv>
<refname>SWFDisplayItem->skewX</refname>
<refpurpose>X-skewに追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->skewx</methodname>
<methodparam><type>float</type><parameter>ddegrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->skewx</function> adds <parameter>ddegrees</parameter>
to current x-skew.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->skewx</function>,
<function>swfdisplayitem->skewy</function> and
<function>swfdisplayitem->skewyto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.skewyto">
<refnamediv>
<refname>SWFDisplayItem->skewYTo</refname>
<refpurpose>Y-skewを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->skewyto</methodname>
<methodparam><type>float</type><parameter>degrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->skewyto</function> sets the
y-skew to <parameter>degrees</parameter>. For <parameter>degrees</parameter>
is 1.0, it means a 45-degree forward slant. More is more upward,
less is more downward.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->skewy</function>,
<function>swfdisplayitem->skewx</function> and
<function>swfdisplayitem->skewxto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.skewy">
<refnamediv>
<refname>SWFDisplayItem->skewY</refname>
<refpurpose>Y-skewに追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->skewy</methodname>
<methodparam><type>float</type><parameter>ddegrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->skewy</function> adds <parameter>ddegrees</parameter>
to current y-skew.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfdisplayitem->skewyto</function>,
<function>swfdisplayitem->skewx</function> and
<function>swfdisplayitem->skewxto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.setdepth">
<refnamediv>
<refname>SWFDisplayItem->setDepth</refname>
<refpurpose>z-orderを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->setdepth</methodname>
<methodparam><type>float</type><parameter>depth</parameter></methodparam>
</methodsynopsis>
<para>
<function>swfdisplayitem->rotate</function> sets the object's
z-order to <parameter>depth</parameter>. Depth defaults to the
order in which instances are created (by add'ing a shape/text to
a movie)- newer ones are on top of older ones. If two objects are
given the same depth, only the later-defined one can be moved.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.remove">
<refnamediv>
<refname>SWFDisplayItem->remove</refname>
<refpurpose>ムービーからオブジェクトを削除する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->remove</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->remove</function> removes this object from
the movie's display list.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<simpara>
See also <function>swfmovie->add</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.setname">
<refnamediv>
<refname>SWFDisplayItem->setName</refname>
<refpurpose>オブジェクトの名前を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->setname</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->setname</function> sets the object's name to
<parameter>name</parameter>, for targetting with action script.
Only useful on sprites.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.setratio">
<refnamediv>
<refname>SWFDisplayItem->setRatio</refname>
<refpurpose>オブジェクト比を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->setratio</methodname>
<methodparam><type>float</type><parameter>ratio</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->setratio</function> sets the object's ratio
to <parameter>ratio</parameter>. Obviously only useful for morphs.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<para>
This simple example will morph nicely three concentric circles.
<example>
<title><function>swfdisplayitem->setname</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new SWFMorph();
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0xff, 0xff);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0xff, 0xff, 0xff);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0xff, 0xff, 0xff);
$g->addEntry(1.00, 0, 0, 0);
$s = $p->getShape1();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0, 0);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0, 0xff, 0);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0, 0, 0xff);
$g->addEntry(1.00, 0, 0, 0);
$s = $p->getShape2();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$f->skewXTo(1.0);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m = new SWFMovie();
$m->setDimension(320, 240);
$i = $m->add($p);
$i->moveTo(160, 120);
for($n=0; $n<=1.001; $n+=0.01)
{
$i->setRatio($n);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.addcolor">
<refnamediv>
<refname>SWFDisplayItem->addColor</refname>
<refpurpose>
このアイテムの色変換に指定した色を追加する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->addcolor</methodname>
<methodparam choice="opt"><type>int</type><parameter>red</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>green</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->addcolor</function> adds the color to
this item's color transform. The color is given in its RGB form.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfdisplayitem.multcolor">
<refnamediv>
<refname>SWFDisplayItem->multColor</refname>
<refpurpose>アイテムの色変換を乗算する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfdisplayitem->multcolor</methodname>
<methodparam choice="opt"><type>int</type><parameter>red</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>green</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfdisplayitem->multcolor</function> multiplies the item's
color transform by the given values.
</para>
<simpara>
The object may be a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function> or a
<function>swfsprite</function> object. It must have been added using
the <function>swfmovie->add</function>.
</simpara>
<para>
This simple example will modify your picture's atmospher
to Halloween (use a landscape or bright picture).
<example>
<title><function>swfdisplayitem->multcolor</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$b = new SWFBitmap("backyard.jpg");
// note use your own picture :-)
$s = new SWFShape();
$s->setRightFill($s->addFill($b));
$s->drawLine($b->getWidth(), 0);
$s->drawLine(0, $b->getHeight());
$s->drawLine(-$b->getWidth(), 0);
$s->drawLine(0, -$b->getHeight());
$m = new SWFMovie();
$m->setDimension($b->getWidth(), $b->getHeight());
$i = $m->add($s);
for($n=0; $n<=20; ++$n)
{
$i->multColor(1.0-$n/10, 1.0, 1.0);
$i->addColor(0xff*$n/20, 0, 0);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- SWFShape -->
<refentry id="function.swfshape">
<refnamediv>
<refname>SWFShape</refname>
<refpurpose>新規に輪郭オブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfshape</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfshape</function> creates a new shape object.
</para>
<simpara>
SWFShape has the following methods : <function>swfshape->setline</function>,
<function>swfshape->addfill</function>, <function>swfshape->setleftfile</function>,
<function>swfshape->setrightfile</function>, <function>swfshape->movepento</function>,
<function>swfshape->movepen</function>, <function>swfshape->drawlineto</function>,
<function>swfshape->drawline</function>, <function>swfshape->drawcurveto</function>
et <function>swfshape->drawcurve</function>.
</simpara>
<para>
This simple example will draw a big red elliptic quadrant.
<example>
<title><function>swfshape</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$s->setLine(40, 0x7f, 0, 0);
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->movePenTo(200, 200);
$s->drawLineTo(6200, 200);
$s->drawLineTo(6200, 4600);
$s->drawCurveTo(200, 4600, 200, 200);
$m = new SWFMovie();
$m->setDimension(6400, 4800);
$m->setRate(12.0);
$m->add($s);
$m->nextFrame();
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfshape.setline">
<refnamediv>
<refname>SWFShape->setLine</refname>
<refpurpose>輪郭の線種を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->setline</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>red</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>green</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfshape->setline</function> sets the shape's line style.
<parameter>width</parameter> is the line's width. If <parameter>width</parameter>
is 0, the line's style is removed (then, all other arguments are ignored).
If <parameter>width</parameter> > 0, then line's color is set to
<parameter>red</parameter>, <parameter>green</parameter>, <parameter>blue</parameter>.
Last parameter <parameter>a</parameter> is optional.
</para>
<simpara>
<function>swfshape->setline</function> accepts 1, 4 or 5 arguments
(not 3 or 2).
</simpara>
<para>
You must declare all line styles before you use them (see example).
</para>
<para>
This simple example will draw a big "!#%*@", in funny colors and
gracious style.
<example>
<title><function>swfshape->setline</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$f1 = $s->addFill(0xff, 0, 0);
$f2 = $s->addFill(0xff, 0x7f, 0);
$f3 = $s->addFill(0xff, 0xff, 0);
$f4 = $s->addFill(0, 0xff, 0);
$f5 = $s->addFill(0, 0, 0xff);
// bug: have to declare all line styles before you use them
$s->setLine(40, 0x7f, 0, 0);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->setLine(40, 0, 0x7f, 0);
$s->setLine(40, 0, 0, 0x7f);
$f = new SWFFont('Techno.fdb');
$s->setRightFill($f1);
$s->setLine(40, 0x7f, 0, 0);
$s->drawGlyph($f, '!');
$s->movePen($f->getWidth('!'), 0);
$s->setRightFill($f2);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->drawGlyph($f, '#');
$s->movePen($f->getWidth('#'), 0);
$s->setRightFill($f3);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->drawGlyph($f, '%');
$s->movePen($f->getWidth('%'), 0);
$s->setRightFill($f4);
$s->setLine(40, 0, 0x7f, 0);
$s->drawGlyph($f, '*');
$s->movePen($f->getWidth('*'), 0);
$s->setRightFill($f5);
$s->setLine(40, 0, 0, 0x7f);
$s->drawGlyph($f, '@');
$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setRate(12.0);
$i = $m->add($s);
$i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfshape.addfill">
<refnamediv>
<refname>SWFShape->addFill</refname>
<refpurpose>塗りつぶし色をシェープに追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->addfill</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<methodsynopsis>
<type>void</type><methodname>swfshape->addfill</methodname>
<methodparam><type>SWFbitmap</type><parameter>bitmap</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<methodsynopsis>
<type>void</type><methodname>swfshape->addfill</methodname>
<methodparam><type>SWFGradient</type><parameter>gradient</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfshape->addfill</function> adds a solid fill to the
shape's list
of fill styles. <function>swfshape->addfill</function> accepts
three different
types of arguments.
</para>
<para>
<parameter>red</parameter>, <parameter>green</parameter>,
<parameter>blue</parameter>
is a color (RGB mode). Last parameter <parameter>a</parameter> is
optional.
</para>
<para>
The <parameter>bitmap</parameter> argument is an <function>swfbitmap</function> object.
The <parameter>flags</parameter> argument can be one
of the following values : SWFFILL_CLIPPED_BITMAP or SWFFILL_TILED_BITMAP.
Default is SWFFILL_TILED_BITMAP. I think.
</para>
<para>
The <parameter>gradient</parameter> argument is an
<function>swfgradient</function>
object. The flags argument can be one of the following values :
SWFFILL_RADIAL_GRADIENT or SWFFILL_LINEAR_GRADIENT. Default is
SWFFILL_LINEAR_GRADIENT. I'm sure about this one. Really.
</para>
<para>
<function>swfshape->addfill</function> returns an <function>swffill</function>
object for use with the <function>swfshape->setfill</function> functions
described below.
</para>
<simpara>
See also <function>swfshape->setfill</function>.
</simpara>
<para>
This simple example will draw a frame on a bitmap. Ah, here's another buglet in
the flash player- it doesn't seem to care about the second shape's bitmap's
transformation in a morph. According to spec, the bitmap should stretch
along with the shape in this example..
<example>
<title><function>swfshape->addfill</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new SWFMorph();
$b = new SWFBitmap("alphafill.jpg");
// use your own bitmap
$width = $b->getWidth();
$height = $b->getHeight();
$s = $p->getShape1();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);
$f->moveTo(-$width/2, -$height/4);
$f->scaleTo(1.0, 0.5);
$s->setLeftFill($f);
$s->movePenTo(-$width/2, -$height/4);
$s->drawLine($width, 0);
$s->drawLine(0, $height/2);
$s->drawLine(-$width, 0);
$s->drawLine(0, -$height/2);
$s = $p->getShape2();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);
// these two have no effect!
$f->moveTo(-$width/4, -$height/2);
$f->scaleTo(0.5, 1.0);
$s->setLeftFill($f);
$s->movePenTo(-$width/4, -$height/2);
$s->drawLine($width/2, 0);
$s->drawLine(0, $height);
$s->drawLine(-$width/2, 0);
$s->drawLine(0, -$height);
$m = new SWFMovie();
$m->setDimension($width, $height);
$i = $m->add($p);
$i->moveTo($width/2, $height/2);
for($n=0; $n<1.001; $n+=0.03)
{
$i->setRatio($n);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfshape.setleftfill">
<refnamediv>
<refname>SWFShape->setLeftFill</refname>
<refpurpose>左ラスター色を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->setleftfill</methodname>
<methodparam><type>swfgradient</type><parameter>fill</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<methodsynopsis>
<type>void</type><methodname>swfshape->setleftfill</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
What this nonsense is about is, every edge segment borders at most two fills.
When rasterizing the object, it's pretty handy to know what those fills are
ahead of time, so the swf format requires these to be specified.
</para>
<para>
<function>swfshape->setleftfill</function> sets the fill on the left side of
the edge- that is, on the interior if you're defining the outline of the shape in a counter-clockwise
fashion. The fill object is an SWFFill object returned from one of the addFill
functions above.
</para>
<para>
This seems to be reversed when you're defining a shape in a morph, though.
If your browser crashes, just try setting the fill on the other side.
</para>
<simpara>
Shortcut for <literal>swfshape->setleftfill($s->addfill($r, $g, $b [, $a]));</literal>.
</simpara>
<simpara>
See also <function>swfshape->setrightfill</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.setrightfill">
<refnamediv>
<refname>SWFShape->setRightFill</refname>
<refpurpose>右ラスター色を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->setrightfill</methodname>
<methodparam><type>swfgradient</type><parameter>fill</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<methodsynopsis>
<type>void</type><methodname>swfshape->setrightfill</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
See also <function>swfshape->setleftfill</function>.
</simpara>
<simpara>
Shortcut for <literal>swfshape->setrightfill($s->addfill($r, $g, $b [, $a]));</literal>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.movepento">
<refnamediv>
<refname>SWFShape->movePenTo</refname>
<refpurpose>シェープのペンを移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->movepento</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->setrightfill</function> move the shape's pen to
(<parameter>x</parameter>,<parameter>y</parameter>) in the shape's
coordinate space.
</simpara>
<simpara>
See also
<function>swfshape->movepen</function>,
<function>swfshape->drawcurveto</function>,
<function>swfshape->drawlineto</function> et
<function>swfshape->drawline</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.movepen">
<refnamediv>
<refname>SWFShape->movePen</refname>
<refpurpose>シェープのペンを(相対)移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->movepen</methodname>
<methodparam><type>int</type><parameter>dx</parameter></methodparam>
<methodparam><type>int</type><parameter>dy</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->setrightfill</function> move the shape's pen from
coordinates (current x,current y) to (current x + <parameter>dx</parameter>,
current y + <parameter>dy</parameter>) in the shape's coordinate space.
</simpara>
<simpara>
See also
<function>swfshape->movepento</function>,
<function>swfshape->drawcurveto</function>,
<function>swfshape->drawlineto</function> et
<function>swfshape->drawline</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.drawlineto">
<refnamediv>
<refname>SWFShape->drawLineTo</refname>
<refpurpose>線を画く</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->drawlineto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->setrightfill</function> draws a line (using the
current line style, set by <function>swfshape->setline</function>) from the current
pen position to point (<parameter>x</parameter>,<parameter>y</parameter>)
in the shape's coordinate space.
</simpara>
<simpara>
See also
<function>swfshape->movepento</function>,
<function>swfshape->drawcurveto</function>,
<function>swfshape->movepen</function> et
<function>swfshape->drawline</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.drawline">
<refnamediv>
<refname>SWFShape->drawLine</refname>
<refpurpose>線を画く (相対座標)</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->drawline</methodname>
<methodparam><type>int</type><parameter>dx</parameter></methodparam>
<methodparam><type>int</type><parameter>dy</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->setrightfill</function> draws a line (using the current line style
set by <function>swfshape->setline</function>) from the current pen position to
displacement (<parameter>dx</parameter>,<parameter>dy</parameter>).
</simpara>
<simpara>
See also
<function>swfshape->movepento</function>,
<function>swfshape->drawcurveto</function>,
<function>swfshape->movepen</function> et
<function>swfshape->drawlineto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.drawcurveto">
<refnamediv>
<refname>SWFShape->drawCurveTo</refname>
<refpurpose>曲線を画く</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->drawcurveto</methodname>
<methodparam><type>int</type><parameter>controlx</parameter></methodparam>
<methodparam><type>int</type><parameter>controly</parameter></methodparam>
<methodparam><type>int</type><parameter>anchorx</parameter></methodparam>
<methodparam><type>int</type><parameter>anchory</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->drawcurveto</function> draws a quadratic curve
(using the current line style, set by <function>swfshape->setline</function>)
from the current pen position to
(<parameter>anchorx</parameter>,<parameter>anchory</parameter>)
using (<parameter>controlx</parameter>,<parameter>controly</parameter>)
as a control point. That is, head towards the control point,
then smoothly turn to the anchor point.
</simpara>
<simpara>
See also
<function>swfshape->drawlineto</function>,
<function>swfshape->drawline</function>,
<function>swfshape->movepento</function> et
<function>swfshape->movepen</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swfshape.drawcurve">
<refnamediv>
<refname>SWFShape->drawCurve</refname>
<refpurpose>曲線を画く (相対座標)</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfshape->drawcurve</methodname>
<methodparam><type>int</type><parameter>controldx</parameter></methodparam>
<methodparam><type>int</type><parameter>controldy</parameter></methodparam>
<methodparam><type>int</type><parameter>anchordx</parameter></methodparam>
<methodparam><type>int</type><parameter>anchordy</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<simpara>
<function>swfshape->drawcurve</function> draws a quadratic curve
(using the current line style,set by <function>swfshape->setline</function>)
from the current pen position to the relative position
(<parameter>anchorx</parameter>,<parameter>anchory</parameter>)
using relative control point
(<parameter>controlx</parameter>,<parameter>controly</parameter>).
That is, head towards the control point, then smoothly turn to the
anchor point.
</simpara>
<simpara>
See also
<function>swfshape->drawlineto</function>,
<function>swfshape->drawline</function>,
<function>swfshape->movepento</function> et
<function>swfshape->movepen</function>.
</simpara>
</refsect1>
</refentry>
<!-- SWFGradient -->
<refentry id="function.swfgradient">
<refnamediv>
<refname>SWFGradient</refname>
<refpurpose>傾きオブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfgradient</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfgradient</function> creates a new SWFGradient object.
</para>
<simpara>
After you've added the entries to your gradient, you can use the gradient
in a shape fill with the <function>swfshape->addfill</function> method.
</simpara>
<simpara>
SWFGradient has the following methods : <function>swfgradient->addentry</function>.
</simpara>
<para>
This simple example will draw a big black-to-white gradient as background,
and a redish disc in its center.
<example>
<title><function>swfgradient</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new SWFMovie();
$m->setDimension(320, 240);
$s = new SWFShape();
// first gradient- black to white
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(1.0, 0xff, 0xff, 0xff);
$f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT);
$f->scaleTo(0.01);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
$s = new SWFShape();
// second gradient- radial gradient from red to transparent
$g = new SWFGradient();
$g->addEntry(0.0, 0xff, 0, 0, 0xff);
$g->addEntry(1.0, 0xff, 0, 0, 0);
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.005);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfgradient.addentry">
<refnamediv>
<refname>SWFGradient->addEntry</refname>
<refpurpose>傾きリストにエントリを追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfgradient->addentry</methodname>
<methodparam><type>float</type><parameter>ratio</parameter></methodparam>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfgradient->addentry</function> adds an entry to the gradient list.
<parameter>ratio</parameter> is a number between 0 and 1 indicating where in
the gradient this color appears. Thou shalt add entries in order of increasing ratio.
</para>
<para>
<parameter>red</parameter>, <parameter>green</parameter>, <parameter>blue</parameter>
is a color (RGB mode). Last parameter <parameter>a</parameter> is optional.
</para>
</refsect1>
</refentry>
<!-- SWFBitmap -->
<refentry id="function.swfbitmap">
<refnamediv>
<refname>SWFBitmap</refname>
<refpurpose>ビットマップオブジェクトをロードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfbitmap</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>alphafilename</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbitmap</function> creates a new SWFBitmap object from
the Jpeg or DBL file named <parameter>filename</parameter>.
<parameter>alphafilename</parameter> indicates a MSK file to
be used as an alpha mask for a Jpeg image.
</para>
<note>
<para>
We can only deal with baseline (frame 0) jpegs, no baseline optimized or
progressive scan jpegs!
</para>
</note>
<simpara>
SWFBitmap has the following methods : <function>swfbitmap->getwidth</function>
and <function>swfbitmap->getheight</function>.
</simpara>
<para>
You can't import png images directly, though- have to use the png2dbl
utility to make a dbl ("define bits lossless") file from the png.
The reason for this is that I don't want a dependency on the png library
in ming- autoconf should solve this, but that's not set up yet.
<example>
<title>Import PNG files</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$f = $s->addFill(new SWFBitmap("png.dbl"));
$s->setRightFill($f);
$s->drawLine(32, 0);
$s->drawLine(0, 32);
$s->drawLine(-32, 0);
$s->drawLine(0, -32);
$m = new SWFMovie();
$m->setDimension(32, 32);
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<para>
And you can put an alpha mask on a jpeg fill.
<example>
<title><function>swfbitmap</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
// .msk file generated with "gif2mask" utility
$f = $s->addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk"));
$s->setRightFill($f);
$s->drawLine(640, 0);
$s->drawLine(0, 480);
$s->drawLine(-640, 0);
$s->drawLine(0, -480);
$c = new SWFShape();
$c->setRightFill($c->addFill(0x99, 0x99, 0x99));
$c->drawLine(40, 0);
$c->drawLine(0, 40);
$c->drawLine(-40, 0);
$c->drawLine(0, -40);
$m = new SWFMovie();
$m->setDimension(640, 480);
$m->setBackground(0xcc, 0xcc, 0xcc);
// draw checkerboard background
for($y=0; $y<480; $y+=40)
{
for($x=0; $x<640; $x+=80)
{
$i = $m->add($c);
$i->moveTo($x, $y);
}
$y+=40;
for($x=40; $x<640; $x+=80)
{
$i = $m->add($c);
$i->moveTo($x, $y);
}
}
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfbitmap.getwidth">
<refnamediv>
<refname>SWFBitmap->getWidth</refname>
<refpurpose>ビットマップの幅を返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>swfbitmap->getwidth</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbitmap->getwidth</function> returns the bitmap's width in pixels.
</para>
<para>
See also <function>swfbitmap->getheight</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbitmap.getheight">
<refnamediv>
<refname>SWFBitmap->getHeight</refname>
<refpurpose>ビットマップの高さを返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>swfbitmap->getheight</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbitmap->getheight</function> returns the bitmap's height in pixels.
</para>
<para>
See also <function>swfbitmap->getwidth</function>.
</para>
</refsect1>
</refentry>
<!-- SWFFill -->
<refentry id="function.swffill">
<refnamediv>
<refname>SWFFill</refname>
<refpurpose>SWFFill オブジェクトをロードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<para>
The <function>swffill</function> object allows you to transform
(scale, skew, rotate) bitmap and gradient fills. <function>swffill</function>
objects are created by the <function>swfshape->addfill</function> methods.
</para>
<simpara>
SWFFill has the following methods : <function>swffill->moveto</function>
and <function>swffill->scaleto</function>, <function>swffill->rotateto</function>,
<function>swffill->skewxto</function> and <function>swffill->skewyto</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swffill.moveto">
<refnamediv>
<refname>SWFFill->moveTo</refname>
<refpurpose>塗りつぶしの原点を移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swffill->moveto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffill->moveto</function> moves fill's origin to
(<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates.
</para>
</refsect1>
</refentry>
<refentry id="function.swffill.scaleto">
<refnamediv>
<refname>SWFFill->scaleTo</refname>
<refpurpose>塗りつぶしの倍率を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swffill->scaleto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffill->scaleto</function> sets fill's scale to
<parameter>x</parameter> in the x-direction,
<parameter>y</parameter> in the y-direction.
</para>
</refsect1>
</refentry>
<refentry id="function.swffill.rotateto">
<refnamediv>
<refname>SWFFill->rotateTo</refname>
<refpurpose>塗りつぶしの回転を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swffill->rotateto</methodname>
<methodparam><type>float</type><parameter>degrees</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffill->rotateto</function> sets fill's rotation to
<parameter>degrees</parameter> degrees.
</para>
</refsect1>
</refentry>
<refentry id="function.swffill.skewxto">
<refnamediv>
<refname>SWFFill->skewXTo</refname>
<refpurpose>x-skewを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swffill->skewxto</methodname>
<methodparam><type>float</type><parameter>x</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffill->skewxto</function> sets fill x-skew to <parameter>x</parameter>.
For <parameter>x</parameter> is 1.0, it is a is a 45-degree
forward slant. More is more forward, less is more backward.
</para>
</refsect1>
</refentry>
<refentry id="function.swffill.skewyto">
<refnamediv>
<refname>SWFFill->skewYTo</refname>
<refpurpose>y-skewを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swffill->skewyto</methodname>
<methodparam><type>float</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffill->skewyto</function> sets fill y-skew to <parameter>y</parameter>.
For <parameter>y</parameter> is 1.0, it is a is a 45-degree
upward slant. More is more upward, less is more downward.
</para>
</refsect1>
</refentry>
<!-- SWFMorph -->
<refentry id="function.swfmorph">
<refnamediv>
<refname>SWFMorph</refname>
<refpurpose>新規にSWFMorphオブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfmorph</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmorph</function> creates a new SWFMorph object.
</para>
<para>
Also called a "shape tween". This thing lets you make those tacky
twisting things that make your computer choke. Oh, joy!
</para>
<para>
The methods here are sort of weird. It would make more sense to just
have newSWFMorph(shape1, shape2);, but as things are now, shape2 needs
to know that it's the second part of a morph. (This, because it starts
writing its output as soon as it gets drawing commands- if it kept its
own description of its shapes and wrote on completion this and some
other things would be much easier.)
</para>
<simpara>
SWFMorph has the following methods : <function>swfmorph->getshape1</function>
and <function>swfmorph->getshape1</function>.
</simpara>
<para>
This simple example will morph a big red square into a smaller
blue black-bordered square.
<example>
<title><function>swfmorph</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new SWFMorph();
$s = $p->getShape1();
$s->setLine(0,0,0,0);
/* Note that this is backwards from normal shapes (left instead of right).
I have no idea why, but this seems to work.. */
$s->setLeftFill($s->addFill(0xff, 0, 0));
$s->movePenTo(-1000,-1000);
$s->drawLine(2000,0);
$s->drawLine(0,2000);
$s->drawLine(-2000,0);
$s->drawLine(0,-2000);
$s = $p->getShape2();
$s->setLine(60,0,0,0);
$s->setLeftFill($s->addFill(0, 0, 0xff));
$s->movePenTo(0,-1000);
$s->drawLine(1000,1000);
$s->drawLine(-1000,1000);
$s->drawLine(-1000,-1000);
$s->drawLine(1000,-1000);
$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setBackground(0xff, 0xff, 0xff);
$i = $m->add($p);
$i->moveTo(1500,1000);
for($r=0.0; $r<=1.0; $r+=0.1)
{
$i->setRatio($r);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfmorph.getshape1">
<refnamediv>
<refname>SWFMorph->getshape1</refname>
<refpurpose>最初のシェープへのハンドルを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>mixed</type><methodname>swfmorph->getshape1</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmorph->getshape1</function> gets a handle to the morph's
starting shape. <function>swfmorph->getshape1</function> returns an
<function>swfshape</function> object.
</para>
</refsect1>
</refentry>
<refentry id="function.swfmorph.getshape2">
<refnamediv>
<refname>SWFMorph->getshape2</refname>
<refpurpose>最後のシェープへのハンドルを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>mixed</type><methodname>swfmorph->getshape2</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfmorph->getshape2</function> gets a handle to the morph's
ending shape. <function>swfmorph->getshape2</function> returns an
<function>swfshape</function> object.
</para>
</refsect1>
</refentry>
<!-- SWFText -->
<refentry id="function.swftext">
<refnamediv>
<refname>SWFMorph</refname>
<refpurpose>新規にSWFTextオブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swftext</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext</function> creates a new SWFText object,
fresh for manipulating.
</para>
<simpara>
SWFText has the following methods : <function>swftext->setfont</function>,
<function>swftext->setheight</function>, <function>swftext->setspacing</function>,
<function>swftext->setcolor</function>, <function>swftext->moveto</function>,
<function>swftext->addstring</function> and <function>swftext->getwidth</function>.
</simpara>
<para>
This simple example will draw a big yellow "PHP generates Flash with Ming"
text, on white background.
<example>
<title><function>swftext</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$f = new SWFFont("Techno.fdb");
$t = new SWFText();
$t->setFont($f);
$t->moveTo(200, 2400);
$t->setColor(0xff, 0xff, 0);
$t->setHeight(1200);
$t->addString("PHP generates Flash with Ming!!");
$m = new SWFMovie();
$m->setDimension(5400, 3600);
$m->add($t);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.setfont">
<refnamediv>
<refname>SWFText->setFont</refname>
<refpurpose>カレントのフォントを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->setfont</methodname>
<methodparam><type>string</type><parameter>font</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->setfont</function> は、カレントのフォントを
<parameter>font</parameter> に設定します。
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.setheight">
<refnamediv>
<refname>SWFText->setHeight</refname>
<refpurpose>カレントのフォントの高さを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->setheight</methodname>
<methodparam><type>int</type><parameter>height</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->setheight</function> sets the current font height to
<parameter>height</parameter>. Default is 240.
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.setspacing">
<refnamediv>
<refname>SWFText->setSpacing</refname>
<refpurpose>カレントのフォントの間隔を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->setspacing</methodname>
<methodparam><type>float</type><parameter>spacing</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->setspacing</function> sets the current font spacing to
<parameter>spacing</parameter><parameter>spacing</parameter>. Default is 1.0.
0 is all of the letters written at the same point. This doesn't really work
that well because it inflates the advance across the letter, doesn't add
the same amount of spacing between the letters. I should try and explain
that better, prolly. Or just fix the damn thing to do constant spacing.
This was really just a way to figure out how letter advances work,
anyway.. So nyah.
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.setcolor">
<refnamediv>
<refname>SWFText->setColor</refname>
<refpurpose>カレントのフォント色を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->setcolor</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->setspacing</function> changes the current text color.
Default is black. I think. Color is represented using the RGB system.
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.moveto">
<refnamediv>
<refname>SWFText->moveTo</refname>
<refpurpose>ペンを移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->moveto</methodname>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->moveto</function> moves the pen (or cursor, if
that makes more sense) to (<parameter>x</parameter>,<parameter>y</parameter>)
in text object's coordinate space. If either is zero, though, value
in that dimension stays the same. Annoying, should be fixed.
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.addstring">
<refnamediv>
<refname>SWFText->addString</refname>
<refpurpose>文字列を画く</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->addstring</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->addstring</function> draws the string <parameter>string</parameter>
at the current pen (cursor) location. Pen is at the baseline of the text;
i.e., ascending text is in the -y direction.
</para>
</refsect1>
</refentry>
<refentry id="function.swftext.getwidth">
<refnamediv>
<refname>SWFText->getWidth</refname>
<refpurpose>文字列の幅を計算する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftext->addstring</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftext->addstring</function> returns the rendered width of the
<parameter>string</parameter> string at the text object's current font,
scale, and spacing settings.
</para>
</refsect1>
</refentry>
<!-- SWFFont -->
<refentry id="function.swffont">
<refnamediv>
<refname>SWFFont</refname>
<refpurpose>フォントの定義をロードする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swffont</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<parameter>filename</parameter> が、FDBファイルの名前(すなわち、
".fdb" で終る)の場合、このファイル中のフォントの定義をロードしま
す。そうでない場合、ブラウザで定義されたフォントリファレンスを作
成します。
</para>
<para>
FDB ("font definition block") は、フォントに関する詳細な情報が記
述されているSWF DefineFont2 ブロック用の非常に簡単なラッパーです。
FDBファイルは、mingの主要ファイルの配布ディレクトリではなくutilディ
レクトリにある付属のmakefdbユーティリティによりSWFジェネレータテ
ンプレートファイルから作成することが可能です。
</para>
<para>
ブラウザで定義されたフォントには、フォント名以外のフォント情報が含
まれていません。フォント定義は、ムービープレイヤーに提供されると
仮定します。フォント _serif, _sans, _typewriter は、常に使用可能
です。例えば、
<programlisting role="php">
<![CDATA[
<?php
$f = newSWFFont("_sans");
?>
]]>
</programlisting>
により、標準的な sans-serif フォントが指定されます。これは、HTML
で <literal><font name="sans-serif"></literal> と指定した場
合とおそらく同じになります。
</para>
<para>
<function>swffont</function> は、フォント定義へのリファレンスを返
します。これは、<function>SWFText->setFont</function> および
<function>SWFTextField->setFont</function> メソッドで使用可能です。
</para>
<simpara>
SWFFont は、次のメソッドを有します :
<function>swffont->getwidth</function>
</simpara>
</refsect1>
</refentry>
<refentry id="function.swffont.getwidth">
<refnamediv>
<refname>getwidth</refname>
<refpurpose>文字列の幅を返す</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>swffont->getwidth</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swffont->getwidth</function> returns the string
<parameter>string</parameter>'s width, using font's default scaling.
You'll probably want to use the <function>SWFText</function> version of this method which
uses the text object's scale.
</para>
</refsect1>
</refentry>
<!-- SWFTextField -->
<refentry id="function.swftextfield">
<refnamediv>
<refname>SWFTextField</refname>
<refpurpose>テキストフィールドのオブジェクトを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swftextfield</methodname>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield</function> creates a new text field object.
Text Fields are less flexible than <function>swftext</function> objects-
they can't be rotated, scaled non-proportionally, or skewed, but they can
be used as form entries, and they can use browser-defined fonts.
</para>
<para>
The optional flags change the text field's behavior. It has the following
possibles values :
<itemizedlist>
<listitem>
<simpara>
SWFTEXTFIELD_NOEDIT indicates that the field shouldn't be user-editable
</simpara>
</listitem>
<listitem>
<simpara>
SWFTEXTFIELD_PASSWORD obscures the data entry
</simpara>
</listitem>
<listitem>
<simpara>
SWFTEXTFIELD_DRAWBOX draws the outline of the textfield
</simpara>
</listitem>
<listitem>
<simpara>
SWFTEXTFIELD_MULTILINE allows multiple lines
</simpara>
</listitem>
<listitem>
<simpara>
SWFTEXTFIELD_WORDWRAP allows text to wrap
</simpara>
</listitem>
<listitem>
<simpara>
SWFTEXTFIELD_NOSELECT makes the field non-selectable
</simpara>
</listitem>
</itemizedlist>
Flags are combined with the bitwise
<link linkend="language.operators.bitwise">OR</link> operation. For example,
<programlisting role="php">
<![CDATA[
<?php
$t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT);
?>
]]>
</programlisting>
creates a totally useless non-editable password field.
</para>
<simpara>
SWFTextField has the following methods : <function>swftextfield->setfont</function>,
<function>swftextfield->setbounds</function>, <function>swftextfield->align</function>,
<function>swftextfield->setheight</function>, <function>swftextfield->setleftmargin</function>,
<function>swftextfield->setrightmargin</function>, <function>swftextfield->setmargins</function>,
<function>swftextfield->setindentation</function>, <function>swftextfield->setlinespacing</function>,
<function>swftextfield->setcolor</function>, <function>swftextfield->setname</function> et
<function>swftextfield->addstring</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setfont">
<refnamediv>
<refname>SWFTextField->setFont</refname>
<refpurpose>テキストフィールドフォントを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setfont</methodname>
<methodparam><type>string</type><parameter>font</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setfont</function> sets the text field font to
the [browser-defined?] <parameter>font</parameter> font.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setbounds">
<refnamediv>
<refname>SWFTextField->setbounds</refname>
<refpurpose>テキストフィールドの幅と高さを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setbounds</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
<methodparam><type>int</type><parameter>height</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setbounds</function> sets the text field width
to <parameter>width</parameter> and height to <parameter>height</parameter>.
If you don't set the bounds yourself, Ming makes a poor guess at what
the bounds are.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.align">
<refnamediv>
<refname>SWFTextField->align</refname>
<refpurpose>テキストフィールドのアライメントを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->align</methodname>
<methodparam><type>int</type><parameter>alignement</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->align</function> sets the text field alignment
to <parameter>alignement</parameter>. Valid values for
<parameter>alignement</parameter> are : SWFTEXTFIELD_ALIGN_LEFT,
SWFTEXTFIELD_ALIGN_RIGHT, SWFTEXTFIELD_ALIGN_CENTER and
SWFTEXTFIELD_ALIGN_JUSTIFY.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setheight">
<refnamediv>
<refname>SWFTextField->setHeight</refname>
<refpurpose>
指定したテキストフィールドフォントの高さを設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setheight</methodname>
<methodparam><type>int</type><parameter>height</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setheight</function> sets the font height of this text field
font to the given height <parameter>height</parameter>. Default is 240.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setleftmargin">
<refnamediv>
<refname>SWFTextField->setLeftMargin</refname>
<refpurpose>テキストフィールドの左マージン幅を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setleftmargin</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setleftmargin</function> sets the left margin width
of the text field to <parameter>width</parameter>. Default is 0.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setrightmargin">
<refnamediv>
<refname>SWFTextField->setrightMargin</refname>
<refpurpose>キストフィールドの右マージン幅を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setrightmargin</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setrightmargin</function> sets the right margin width
of the text field to <parameter>width</parameter>. Default is 0.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setmargins">
<refnamediv>
<refname>SWFTextField->setMargins</refname>
<refpurpose>テキストフィールドのマージン幅を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setmargins</methodname>
<methodparam><type>int</type><parameter>left</parameter></methodparam>
<methodparam><type>int</type><parameter>right</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setmargins</function> set both margins at once,
for the man on the go.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setindentation">
<refnamediv>
<refname>SWFTextField->setindentation</refname>
<refpurpose>先頭行のインデントを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setindentation</methodname>
<methodparam><type>int</type><parameter>width</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setindentation</function> sets the indentation of
the first line in the text field, to <parameter>width</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setlinespacing">
<refnamediv>
<refname>SWFTextField->setLineSpacing</refname>
<refpurpose>テキストフィールドの行間を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setlinespacing</methodname>
<methodparam><type>int</type><parameter>height</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setlinespacing</function> sets the line spacing
of the text field to the height of <parameter>height</parameter>. Default is 40.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setcolor">
<refnamediv>
<refname>SWFTextField->setcolor</refname>
<refpurpose>テキストフィールドの色を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setcolor</methodname>
<methodparam><type>int</type><parameter>red</parameter></methodparam>
<methodparam><type>int</type><parameter>green</parameter></methodparam>
<methodparam><type>int</type><parameter>blue</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>a</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setcolor</function> sets the color of the text field.
Default is fully opaque black. Color is represented using RGB system.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.setname">
<refnamediv>
<refname>SWFTextField->setname</refname>
<refpurpose>変数名を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->setname</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setname</function> sets the variable name of this
text field to <parameter>name</parameter>, for form posting and action
scripting purposes.
</para>
</refsect1>
</refentry>
<refentry id="function.swftextfield.addstring">
<refnamediv>
<refname>SWFTextField->addstring</refname>
<refpurpose>指定した文字列をテキストフィールドに結合する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swftextfield->addstring</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swftextfield->setname</function> は、文字列
<parameter>string</parameter>をテキストフィールドに結合します。
</para>
</refsect1>
</refentry>
<!-- SWFSprite -->
<refentry id="function.swfsprite">
<refnamediv>
<refname>SWFSprite</refname>
<refpurpose>ムービークリップ(スプライト)を作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfsprite</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfsprite</function> are also known as a "movie clip",
this allows one to create objects which are animated in their own
timelines. Hence, the sprite has most of the same methods as the movie.
</para>
<simpara>
<function>swfsprite</function> has the following methods :
<function>swfsprite->add</function>,
<function>swfsprite->remove</function>, <function>swfsprite->nextframe</function>
et <function>swfsprite->setframes</function>.
</simpara>
<para>
This simple example will spin gracefully a big red square.
<example>
<title><function>swfsprite</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->movePenTo(-500,-500);
$s->drawLineTo(500,-500);
$s->drawLineTo(500,500);
$s->drawLineTo(-500,500);
$s->drawLineTo(-500,-500);
$p = new SWFSprite();
$i = $p->add($s);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$m = new SWFMovie();
$i = $m->add($p);
$i->moveTo(1500,1000);
$i->setName("blah");
$m->setBackground(0xff, 0xff, 0xff);
$m->setDimension(3000,2000);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfsprite.add">
<refnamediv>
<refname>SWFSprite->add</refname>
<refpurpose>オブジェクトをスプライトに追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfsprite->add</methodname>
<methodparam><type>resource</type><parameter>object</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfsprite->add</function> adds a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function>,
a <function>swfaction</function> or a <function>swfsprite</function> object.
</para>
<para>
For displayable types (<function>swfshape</function>,
<function>swfbutton</function>, <function>swftext</function>,
<function>swfaction</function> or <function>swfsprite</function>),
this returns a handle to the object in a display list.
</para>
</refsect1>
</refentry>
<refentry id="function.swfsprite.remove">
<refnamediv>
<refname>SWFSprite->remove</refname>
<refpurpose>オブジェクトをスプライトから削除する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfsprite->remove</methodname>
<methodparam><type>ressource</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
<function>swfsprite->remove</function> remove a <function>swfshape</function>, a
<function>swfbutton</function>, a <function>swftext</function>,
a <function>swfaction</function> or a <function>swfsprite</function> object
from the sprite.
</para>
</refsect1>
</refentry>
<refentry id="function.swfsprite.setframes">
<refnamediv>
<refname>SWFSprite->setframes</refname>
<refpurpose>アニメーションの総フレーム数を設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfsprite->setframes</methodname>
<methodparam><type>int</type><parameter>numberofframes</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfsprite->setframes</function> sets the total number of frames
in the animation to <parameter>numberofframes</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfsprite.nextframe">
<refnamediv>
<refname>SWFSprite->nextframe</refname>
<refpurpose>アニメーションの次のフレームに移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfsprite->nextframe</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfsprite->setframes</function> moves to the next frame of
the animation.
</para>
</refsect1>
</refentry>
<!-- SWFButton -->
<refentry id="function.swfbutton">
<refnamediv>
<refname>SWFbutton</refname>
<refpurpose>新規ボタンを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfbutton</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton</function> creates a new Button.
Roll over it, click it, see it call action code. Swank.
</para>
<simpara>
SWFButton has the following methods : <function>swfbutton->addshape</function>,
<function>swfbutton->setup</function>, <function>swfbutton->setover</function>
<function>swfbutton->setdown</function>, <function>swfbutton->sethit</function>
<function>swfbutton->setaction</function> and
<function>swfbutton->addaction</function>.
</simpara>
<para>
This simple example will show your usual interactions with buttons :
rollover, rollon, mouseup, mousedown, noaction.
<example>
<title><function>swfbutton</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$f = new SWFFont("_serif");
$p = new SWFSprite();
function label($string)
{
global $f;
$t = new SWFTextField();
$t->setFont($f);
$t->addString($string);
$t->setHeight(200);
$t->setBounds(3200,200);
return $t;
}
function addLabel($string)
{
global $p;
$i = $p->add(label($string));
$p->nextFrame();
$p->remove($i);
}
$p->add(new SWFAction("stop();"));
addLabel("NO ACTION");
addLabel("SWFBUTTON_MOUSEUP");
addLabel("SWFBUTTON_MOUSEDOWN");
addLabel("SWFBUTTON_MOUSEOVER");
addLabel("SWFBUTTON_MOUSEOUT");
addLabel("SWFBUTTON_MOUSEUPOUTSIDE");
addLabel("SWFBUTTON_DRAGOVER");
addLabel("SWFBUTTON_DRAGOUT");
function rect($r, $g, $b)
{
$s = new SWFShape();
$s->setRightFill($s->addFill($r, $g, $b));
$s->drawLine(600,0);
$s->drawLine(0,600);
$s->drawLine(-600,0);
$s->drawLine(0,-600);
return $s;
}
$b = new SWFButton();
$b->addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT);
$b->addShape(rect(0, 0xff, 0), SWFBUTTON_OVER);
$b->addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"),
SWFBUTTON_MOUSEUP);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"),
SWFBUTTON_MOUSEDOWN);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"),
SWFBUTTON_MOUSEOVER);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"),
SWFBUTTON_MOUSEOUT);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"),
SWFBUTTON_MOUSEUPOUTSIDE);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"),
SWFBUTTON_DRAGOVER);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"),
SWFBUTTON_DRAGOUT);
$m = new SWFMovie();
$m->setDimension(4000,3000);
$i = $m->add($p);
$i->setName("label");
$i->moveTo(400,1900);
$i = $m->add($b);
$i->moveTo(400,900);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<para>
This simple example will enables you to drag draw a big red button
on the windows. No drag-and-drop, just moving around.
<example>
<title><function>swfbutton->addaction</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->drawLine(1000,0);
$s->drawLine(0,1000);
$s->drawLine(-1000,0);
$s->drawLine(0,-1000);
$b = new SWFButton();
$b->addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b->addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse
SWFBUTTON_MOUSEDOWN);
$b->addAction(new SWFAction("stopDrag();"),
SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE);
$p = new SWFSprite();
$p->add($b);
$p->nextFrame();
$m = new SWFMovie();
$i = $m->add($p);
$i->setName('test');
$i->moveTo(1000,1000);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.addshape">
<refnamediv>
<refname>SWFbutton->addShape</refname>
<refpurpose>ボタンにシェープを追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->addshape</methodname>
<methodparam><type>ressource</type><parameter>shape</parameter></methodparam>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->addshape</function> adds the shape
<parameter>shape</parameter> to this button. The following
<parameter>flags</parameter>' values are valid:
SWFBUTTON_UP, SWFBUTTON_OVER, SWFBUTTON_DOWN or SWFBUTTON_HIT.
SWFBUTTON_HIT isn't ever displayed, it defines the hit region for the button.
That is, everywhere the hit shape would be drawn is considered a "touchable"
part of the button.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.setup">
<refnamediv>
<refname>SWFbutton->setUp</refname>
<refpurpose>addShape(shape, SWFBUTTON_UP)へのエイリアス</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->setup</methodname>
<methodparam><type>ressource</type><parameter>shape</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->setup</function> alias for addShape(shape, SWFBUTTON_UP).
</para>
<para>
See also
<function>swfbutton->addshape</function> and
<function>SWFAction</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.setover">
<refnamediv>
<refname>SWFbutton->setOver</refname>
<refpurpose>addShape(shape, SWFBUTTON_OVER)へのエイリアス</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->setover</methodname>
<methodparam><type>ressource</type><parameter>shape</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->setup</function> alias for addShape(shape, SWFBUTTON_OVER).
</para>
<para>
See also
<function>swfbutton->addshape</function> and
<function>SWFAction</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.sethit">
<refnamediv>
<refname>SWFbutton->setHit</refname>
<refpurpose>addShape(shape, SWFBUTTON_HIT)へのエイリアス</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->sethit</methodname>
<methodparam><type>ressource</type><parameter>shape</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->sethit</function> alias for addShape(shape, SWFBUTTON_HIT).
</para>
<para>
See also
<function>swfbutton->addshape</function> and
<function>SWFAction</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.addaction">
<refnamediv>
<refname>SWFbutton->addAction</refname>
<refpurpose>アクションを追加する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->addaction</methodname>
<methodparam><type>ressource</type><parameter>action</parameter></methodparam>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->addaction</function> adds the action
<parameter>action</parameter> to this button for the given conditions.
The following <parameter>flags</parameter> are valid:
SWFBUTTON_MOUSEOVER, SWFBUTTON_MOUSEOUT, SWFBUTTON_MOUSEUP,
SWFBUTTON_MOUSEUPOUTSIDE, SWFBUTTON_MOUSEDOWN, SWFBUTTON_DRAGOUT and
SWFBUTTON_DRAGOVER.
</para>
<para>
See also
<function>swfbutton->addshape</function> and
<function>SWFAction</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.swfbutton.setAction">
<refnamediv>
<refname>SWFbutton->setAction</refname>
<refpurpose>アクションを設定する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>swfbutton->setaction</methodname>
<methodparam><type>ressource</type><parameter>action</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfbutton->setaction</function> sets the action to be performed
when the button is clicked. Alias for addAction(shape, SWFBUTTON_MOUSEUP).
<parameter>action</parameter> is a <function>swfaction</function>.
</para>
<para>
See also
<function>swfbutton->addshape</function> and
<function>SWFAction</function>.
</para>
</refsect1>
</refentry>
<!-- SWFAction -->
<refentry id="function.swfaction">
<refnamediv>
<refname>SWFAction</refname>
<refpurpose>新規アクションを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>new</type><methodname>swfaction</methodname>
<methodparam><type>string</type><parameter>script</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>swfaction</function> creates a new Action, and
compiles the given script into an SWFAction object.
</para>
<para>
The script syntax is based on the C language, but with a lot taken out- the SWF
bytecode machine is just too simpleminded to do a lot of things we might like.
For instance, we can't implement function calls without a tremendous
amount of hackery because the jump bytecode has a hardcoded offset
value. No pushing your calling address to the stack and returning-
every function would have to know exactly where to return to.
</para>
<para>
So what's left? The compiler recognises the following tokens:
<itemizedlist>
<listitem>
<simpara>
break
</simpara>
</listitem>
<listitem>
<simpara>
for
</simpara>
</listitem>
<listitem>
<simpara>
continue
</simpara>
</listitem>
<listitem>
<simpara>
if
</simpara>
</listitem>
<listitem>
<simpara>
else
</simpara>
</listitem>
<listitem>
<simpara>
do
</simpara>
</listitem>
<listitem>
<simpara>
while
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
There is no typed data; all values in the SWF action machine are stored as strings.
The following functions can be used in expressions:
<variablelist>
<varlistentry>
<term>time()</term>
<listitem>
<simpara>
Returns the number of milliseconds (?) elapsed since the movie started.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>random(seed)</term>
<listitem>
<simpara>
Returns a pseudo-random number in the range 0-seed.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>length(expr)</term>
<listitem>
<simpara>
Returns the length of the given expression.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>int(number)</term>
<listitem>
<simpara>
Returns the given number rounded down to the nearest integer.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>concat(expr, expr)</term>
<listitem>
<simpara>
Returns the concatenation of the given expressions.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>ord(expr)</term>
<listitem>
<simpara>
Returns the ASCII code for the given character
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>chr(num)</term>
<listitem>
<simpara>
Returns the character for the given ASCII code
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>substr(string, location, length)</term>
<listitem>
<simpara>
Returns the substring of length length at location location of
the given string string.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Additionally, the following commands may be used:
<variablelist>
<varlistentry>
<term>duplicateClip(clip, name, depth)</term>
<listitem>
<simpara>
Duplicate the named movie clip (aka sprite). The new movie clip has name name
and is at depth depth.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>removeClip(expr)</term>
<listitem>
<simpara>
Removes the named movie clip.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>trace(expr)</term>
<listitem>
<simpara>
Write the given expression to the trace log. Doubtful that the browser
plugin does anything with this.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>startDrag(target, lock, [left, top, right, bottom])</term>
<listitem>
<simpara>
Start dragging the movie clip target. The lock argument indicates whether
to lock the mouse (?)- use 0 (&false;) or 1 (&true;). Optional parameters
define a bounding area for the dragging.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stopDrag()</term>
<listitem>
<simpara>
Stop dragging my heart around. And this movie clip, too.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>callFrame(expr)</term>
<listitem>
<simpara>
Call the named frame as a function.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>getURL(url, target, [method])</term>
<listitem>
<simpara>
Load the given url into the named target. The target argument can be a
frame name (I think), or one of the magical values "_level0" (replaces
current movie) or "_level1" (loads new movie on top of current movie).
The optional method argument can be post or get if you want to submit
variables back to the server.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>loadMovie(url, target)</term>
<listitem>
<simpara>
Same as above, more or less. Come to think of it, I don't quite know what
the difference is.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>nextFrame()</term>
<listitem>
<simpara>
Go to the next frame.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>prevFrame()</term>
<listitem>
<simpara>
Go to the last (or, rather, previous) frame.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>play()</term>
<listitem>
<simpara>
Start playing the movie.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stop()</term>
<listitem>
<simpara>
Stop playing the movie.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>toggleQuality()</term>
<listitem>
<simpara>
Toggle between high and low quality.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stopSounds()</term>
<listitem>
<simpara>
Stop playing all sounds.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>gotoFrame(num)</term>
<listitem>
<simpara>
Go to frame number num. Frame numbers start at 0.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>gotoFrame(name)</term>
<listitem>
<simpara>
Go to the frame named name. Which does a lot of good, since I
haven't added frame labels yet.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>setTarget(expr)</term>
<listitem>
<simpara>
Sets the context for action. Or so they say- I really have no
idea what this does.
</simpara>
</listitem>
</varlistentry>
</variablelist>
And there's one weird extra thing. The expression frameLoaded(num) can be used
in if statements and while loops to check if the given frame number has been
loaded yet. Well, it's supposed to, anyway, but I've never tested it and I
seriously doubt it actually works. You can just use /:framesLoaded instead.
</para>
<para>
Movie clips (all together now- aka sprites) have properties. You can
read all of them (or can you?), you can set some of them, and here
they are:
<itemizedlist>
<listitem>
<simpara>
x
</simpara>
</listitem>
<listitem>
<simpara>
y
</simpara>
</listitem>
<listitem>
<simpara>
xScale
</simpara>
</listitem>
<listitem>
<simpara>
yScale
</simpara>
</listitem>
<listitem>
<simpara>
currentFrame - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
totalFrames - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
alpha - transparency level
</simpara>
</listitem>
<listitem>
<simpara>
visible - 1=on, 0=off (?)
</simpara>
</listitem>
<listitem>
<simpara>
width - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
height - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
rotation
</simpara>
</listitem>
<listitem>
<simpara>
target - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
framesLoaded - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
name
</simpara>
</listitem>
<listitem>
<simpara>
dropTarget - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
url - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
highQuality - 1=high, 0=low (?)
</simpara>
</listitem>
<listitem>
<simpara>
focusRect - (???)
</simpara>
</listitem>
<listitem>
<simpara>
soundBufTime - (???)
</simpara>
</listitem>
</itemizedlist>
So, setting a sprite's x position is as simple as <literal>/box.x = 100;</literal>.
Why the slash in front of the box, though? That's how flash keeps
track of the sprites in the movie, just like a unix filesystem-
here it shows that box is at the top level. If the sprite named
box had another sprite named biff inside of it, you'd set its x
position with /box/biff.x = 100;. At least, I think so; correct
me if I'm wrong here.
</para>
<para>
This simple example will move the red square across the window.
<example>
<title><function>swfaction</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$s = new SWFShape();
$f = $s->addFill(0xff, 0, 0);
$s->setRightFill($f);
$s->movePenTo(-500,-500);
$s->drawLineTo(500,-500);
$s->drawLineTo(500,500);
$s->drawLineTo(-500,500);
$s->drawLineTo(-500,-500);
$p = new SWFSprite();
$i = $p->add($s);
$i->setDepth(1);
$p->nextFrame();
for($n=0; $n<5; ++$n)
{
$i->rotate(-15);
$p->nextFrame();
}
$m = new SWFMovie();
$m->setBackground(0xff, 0xff, 0xff);
$m->setDimension(6000,4000);
$i = $m->add($p);
$i->setDepth(1);
$i->moveTo(-500,2000);
$i->setName("box");
$m->add(new SWFAction("/box.x += 3;"));
$m->nextFrame();
$m->add(new SWFAction("gotoFrame(0); play();"));
$m->nextFrame();
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<para>
This simple example tracks down your mouse on the screen.
<example>
<title><function>swfaction</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new SWFMovie();
$m->setRate(36.0);
$m->setDimension(1200, 800);
$m->setBackground(0, 0, 0);
/* mouse tracking sprite - empty, but follows mouse so we can
get its x and y coordinates */
$i = $m->add(new SWFSprite());
$i->setName('mouse');
$m->add(new SWFAction("
startDrag('/mouse', 1); /* '1' means lock sprite to the mouse */
"));
/* might as well turn off antialiasing, since these are just squares. */
$m->add(new SWFAction("
this.quality = 0;
"));
/* morphing box */
$r = new SWFMorph();
$s = $r->getShape1();
/* Note this is backwards from normal shapes. No idea why. */
$s->setLeftFill($s->addFill(0xff, 0xff, 0xff));
$s->movePenTo(-40, -40);
$s->drawLine(80, 0);
$s->drawLine(0, 80);
$s->drawLine(-80, 0);
$s->drawLine(0, -80);
$s = $r->getShape2();
$s->setLeftFill($s->addFill(0x00, 0x00, 0x00));
$s->movePenTo(-1, -1);
$s->drawLine(2, 0);
$s->drawLine(0, 2);
$s->drawLine(-2, 0);
$s->drawLine(0, -2);
/* sprite container for morphing box -
this is just a timeline w/ the box morphing */
$box = new SWFSprite();
$box->add(new SWFAction("
stop();
"));
$i = $box->add($r);
for($n=0; $n<=20; ++$n)
{
$i->setRatio($n/20);
$box->nextFrame();
}
/* this container sprite allows us to use the same action code many times */
$cell = new SWFSprite();
$i = $cell->add($box);
$i->setName('box');
$cell->add(new SWFAction("
setTarget('box');
/* ...x means the x coordinate of the parent, i.e. (..).x */
dx = (/mouse.x + random(6)-3 - ...x)/5;
dy = (/mouse.y + random(6)-3 - ...y)/5;
gotoFrame(int(dx*dx + dy*dy));
"));
$cell->nextFrame();
$cell->add(new SWFAction("
gotoFrame(0);
play();
"));
$cell->nextFrame();
/* finally, add a bunch of the cells to the movie */
for($x=0; $x<12; ++$x)
{
for($y=0; $y<8; ++$y)
{
$i = $m->add($cell);
$i->moveTo(100*$x+50, 100*$y+50);
}
}
$m->nextFrame();
$m->add(new SWFAction("
gotoFrame(1);
play();
"));
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<para>
Same as above, but with nice colored balls...
<example>
<title><function>swfaction</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new SWFMovie();
$m->setDimension(11000, 8000);
$m->setBackground(0x00, 0x00, 0x00);
$m->add(new SWFAction("
this.quality = 0;
/frames.visible = 0;
startDrag('/mouse', 1);
"));
// mouse tracking sprite
$t = new SWFSprite();
$i = $m->add($t);
$i->setName('mouse');
$g = new SWFGradient();
$g->addEntry(0, 0xff, 0xff, 0xff, 0xff);
$g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff);
$g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f);
$g->addEntry(1.0, 0xff, 0xff, 0xff, 0);
// gradient shape thing
$s = new SWFShape();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.03);
$s->setRightFill($f);
$s->movePenTo(-600, -600);
$s->drawLine(1200, 0);
$s->drawLine(0, 1200);
$s->drawLine(-1200, 0);
$s->drawLine(0, -1200);
// need to make this a sprite so we can multColor it
$p = new SWFSprite();
$p->add($s);
$p->nextFrame();
// put the shape in here, each frame a different color
$q = new SWFSprite();
$q->add(new SWFAction("gotoFrame(random(7)+1); stop();"));
$i = $q->add($p);
$i->multColor(1.0, 1.0, 1.0);
$q->nextFrame();
$i->multColor(1.0, 0.5, 0.5);
$q->nextFrame();
$i->multColor(1.0, 0.75, 0.5);
$q->nextFrame();
$i->multColor(1.0, 1.0, 0.5);
$q->nextFrame();
$i->multColor(0.5, 1.0, 0.5);
$q->nextFrame();
$i->multColor(0.5, 0.5, 1.0);
$q->nextFrame();
$i->multColor(1.0, 0.5, 1.0);
$q->nextFrame();
// finally, this one contains the action code
$p = new SWFSprite();
$i = $p->add($q);
$i->setName('frames');
$p->add(new SWFAction("
dx = (/:mousex-/:lastx)/3 + random(10)-5;
dy = (/:mousey-/:lasty)/3;
x = /:mousex;
y = /:mousey;
alpha = 100;
"));
$p->nextFrame();
$p->add(new SWFAction("
this.x = x;
this.y = y;
this.alpha = alpha;
x += dx;
y += dy;
dy += 3;
alpha -= 8;
"));
$p->nextFrame();
$p->add(new SWFAction("prevFrame(); play();"));
$p->nextFrame();
$i = $m->add($p);
$i->setName('frames');
$m->nextFrame();
$m->add(new SWFAction("
lastx = mousex;
lasty = mousey;
mousex = /mouse.x;
mousey = /mouse.y;
++num;
if(num == 11)
num = 1;
removeClip('char' & num);
duplicateClip(/frames, 'char' & num, num);
"));
$m->nextFrame();
$m->add(new SWFAction("prevFrame(); play();"));
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
<para>
This simple example will handles keyboard actions.
(You'll probably have to click in the window to give it focus.
And you'll probably have to leave your mouse in the frame, too.
If you know how to give buttons focus programatically, feel free
to share, won't you?)
<example>
<title><function>swfaction</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* sprite has one letter per frame */
$p = new SWFSprite();
$p->add(new SWFAction("stop();"));
$chars = "abcdefghijklmnopqrstuvwxyz".
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
"1234567890!@#$%^&/*()_+-=/[]{}|;:,.<>?`~";
$f = new SWFFont("_sans");
for($n=0; $nremove($i);
$t = new SWFTextField();
$t->setFont($f);
$t->setHeight(240);
$t->setBounds(600,240);
$t->align(SWFTEXTFIELD_ALIGN_CENTER);
$t->addString($c);
$i = $p->add($t);
$p->labelFrame($c);
$p->nextFrame();
}
/* hit region for button - the entire frame */
$s = new SWFShape();
$s->setFillStyle0($s->addSolidFill(0, 0, 0, 0));
$s->drawLine(600, 0);
$s->drawLine(0, 400);
$s->drawLine(-600, 0);
$s->drawLine(0, -400);
/* button checks for pressed key, sends sprite to the right frame */
$b = new SWFButton();
$b->addShape($s, SWFBUTTON_HIT);
for($n=0; $naddAction(new SWFAction("
setTarget('/char');
gotoFrame('$c');
"), SWFBUTTON_KEYPRESS($c));
}
$m = new SWFMovie();
$m->setDimension(600,400);
$i = $m->add($p);
$i->setName('char');
$i->moveTo(0,80);
$m->add($b);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|