========================================
How To Introduce HotSpots In .avi Video Clips Using VB5's Animated Control
by
Huen Y.K.
CAHRC, P.O.Box 1003, Singapore 911101
http://web.singnet.com.sg/~huens/
email: huens@singnet.com.sg
email: huens@mbox3.singnet.com.sg
(A short communication released by the author on: 11/7/97)
Abstract
The paper describes how to get more out of the animation control in VB5 without doing more
work. Animation controls are used to run .avi video clips. The development of avi files can be
done by a well known third party softwares such as Corel 7. Although .avi files can run both
sound and video, animation control can only run silent videos. This is not a great loss since
sound files are still hogging too much bandwidth in the Internet. Unless really needed, the author
desists from including .wav files in webpages. Multiple animation controls can be mounted in
layers so that some can be assigned as video hotspots so that whenever the mouse is dragged
in the down position over an assigned area, another video clip will pop and play. You can cause
it to stop by lifting your finger from the mouse button whilst within the rectangle. Videos within
videos can thus be introduced with great simplicity. Potential applications are found in the
design of visually attractive instructional manuals. Since VB5 includes actiVEX technology,
distributing these over the Internet is a real possibility.
1. Introduction
Nowadays most academics might look askance at me if I tell them that I used solely VB5 for
academic computing and publications. They wrongly associate modern VB with the primitive
GWBasic packaged into DOS-1 in those pioneering days of Bill Gates. All computing languages
are evolving. Even Fortran has transformed into Fortran 90 which hosted many new features
and is still the language of choice in Supercomputer programming. The learning curve of C++ is
just too steep and for busy scientists or mathematicians who have other preoccupations, I
recommend VB. I switch from C++ to VB for that very reason and I never regretted on my
choice. With each upgrade of VB, it is hosting almost as many OOP features as C++ so that the
need to learn the latter has receded. Most of us seldom need to drive a compiler to its very
limit. So why not use VB instead for programs with short shelf lives?
2. Animation Control In VB5
An .avi clip is a series of bitmap frames like a movie. One example is the piece of paper that
"flies" between folders when copying files in the Windows 95 system. Although AVI clips can
have sound, such clips cannot be used with the Animation control as only silent AVI clips can be
used. To display avi files with sound one should use the Multimedia (MCI) control.
The basic operations for animation control are few being confined to Open, Play, Stop, and
Close methods. You open an .avi file using the Open method, play it using the Play method, and
stop it with the Stop method. All gif files can run multithreaded and it is not necessary to close
one file after another like what we do with file read/write operations. Assuming that you have an
avi file called test.avi which you have designed yourself using either a shareware gif animator or
Corel 7. In the first example, we setup two command buttons controls alled cmdPlay and
cmdStop. We set up an animation control called anmAvi. You can place these control
interactively in design mode and test it immediately in run mode. We assume that the VB5
project called video.vbj will be placed in the same directory as the video clip called test.avi. The
three lines of code below will do it although it is the author's habit to introduce two menuitem
called Cls and Exit, the purpose of which is self explanatory.
Example 1:
Project: video1.vbj
Form1: video1.frm
Module: video1.bas
Option Explicit
'====Start video clip by clicking Play command button=====
Private Sub cmdPlay_Click
anmAvi.Open "c:\vb5\test.avi"
anmAvi.Play
End Sub
'====Stop video clip by clicking on Stop command button==
Private Sub cmdStop_Click
anmAvi.Stop
End Sub
'====Click menuitem to clear screen=================
Private Sub memCLS_Click()
Cls
End Sub
'====Click menutitem to end project=================
Private Sub memEND_Click()
End
End Sub
'===========================================
Here are the screen layouts:
Menuitem Bar:
---------------------------------------------------------------------------------------------------
Cls Exit
----------------------------------------------------------------------------------------------------
cmdPlay
-----------------------------
| Open and Play | Visible at run time
-----------------------------
cmdStop
-----------------------------
| Stop | Visible at run time
-----------------------------
Animation Control
------------------------------------------------------------
| Animation Control (Invisible at run time) |
------------------------------------------------------------
Expected results:
The test.avi video clip will start playing when cmdPlay is clicked. It will stop play when cmdStop
is clicked. It will be cleared from the screen when cmdClose is clicked. You can repeat by
clicking these command buttons again. Exit menuitem will exit the project. Cls menuitem
should clear the screen but it is doing nothing since there is nothing to clear.
Example 2: This example is more ambitious. Athough you can stop the video in example 1,
you cannot clear it from the screen. The Cls menuitem only works on Form1 itself. test1.avi is a
larger rectangle and is assigned as the container of test2.avi. Both are invisible at run time until
the cmdPlay button is clicked. Then test1.avi will play but tes2.avi remains static but its small
thumnail is visible. If you clikc within it, it will also start running. Both can be stopped by clicking
cmdStop but can only be clear from the screen by clicking on cmdClose. Close method is not
enough to clear the videos from the screen. You have got to make them invisible.
Option Explicit
'=================================
Private Sub anmAvi2_Click()
anmAvi2.Visible = True
anmAvi2.Open "c:\vb5\yyy.avi"
anmAvi2.Play
End Sub
'==================================
Private Sub cmdPlay_Click()
'dlgOpen.Filter = "laser.wav"
'dlgOpen.ShowOpen
anmAvi.Visible = True
anmAvi2.Visible = True
anmAvi.Open "c:\vb5\xxx.avi"
anmAvi.Play
End Sub
'==================================
Private Sub cmdStop_Click()
anmAvi.Stop
anmAvi2.Stop
End Sub
'==================================
Private Sub cmdClose_Click()
anmAvi.Visible = False
anmAvi2.Visible = False
anmAvi.Close
anmAvi2.Close
End Sub
'===================================
Private Sub memCLS_Click()
Cls
End Sub
'====================================
Private Sub memEND_Click()
End
End Sub
'=====================================
Menuitem Bar:
---------------------------------------------------------------------------------------------------
Cls Exit
----------------------------------------------------------------------------------------------------
cmdPlay
-----------------------------
| Open and Play | Visible at run time
-----------------------------
cmdStop
-----------------------------
| Stop | Visible at run time
-----------------------------
cmdClose
-----------------------------
| Close | Visible at run time
-----------------------------
Animation Control
------------------------------------------------------------
| AnmAvi (Invisible at run time) |
| |
| -------------------------------------------- |
| |AnmAvi2 (Invisible at run time)| |
| -------------------------------------------- |
| |
| |
------------------------------------------------------------
3. Brief Description Of Making .avi Video Clips
I found that Corel 5's Corelmove can only generate animated gif files, not avi files. On the other
hand Corel 7's Corel Paint can generate both gif and avi files. This is very handy since it means
that we can convert from one format to the other without leaving the software environment. If
one is only interested in presenting Cartoon type of animations, animated gifs are most suitable
but if one wants to present a video clip of some homemade movies or photographic stills
snapped by digital cameras, then video clips are more suitable. I am sure readers have got their
own preference from previous experience. So I choose to be brief here.
4. Summary
Basically, one could improvise video hotspots using VB5's animation controls by mounting them
in layers. The author has experiemented briefly with it and consider that there are more
potentials than what has been discovered in an afternoon on the PC. I leave it to the imagination
of readers to do more with it than what I have done. Since it is possible to roll one's own control
in VB5, it will make it easier to improvise simple hotspot systems or video within video systems
in a webpage provided one is experience in activeVEX programming.
5 References
1. Microsoft Reference Manual: Component Tools Guide, Microsoft Visual Basic 5 -
Programming System for Windows. Document No. DD93014-1296 pp 14-16. (Printed in
Singapore).
2.Danesh A. and Tatters W.(1996) : ActiveX Controls, chapter 34, pp426 to 439, JavaScript
1.1 Developer's Guide, Sams net (U.S.A.)
3. Spencer, K.L., Miller, K.C. & Lassesen L.(1996 ):ActiveX animation, chapter 12, pp231 to
258, Introducing VBScript and Activex, IDG Books (U.S.A.)
=========================END OF PAPER ==============================
=======================================
1. Introduction
From textbooks, an algebraic number u is defined as a complex number which satisfies a
polynomial equation with rational coefficients not all zero. An algebraic number is any complex
number which is algebraic over the field Q of rationals [1,2]. In sequence algebra, a sequence
number is a normalised sequence with unity values of coefficients not all zero and is algebraic
over the integer domaim. Thus there is no connection between algebraic numbers and
sequence numbers. The name sequence number is chosen because these have properties
analogous to those of the natural number system inclusive of primeness and compositeness.
This paper is confined to the investigations of sequence numbers in the integer domain.
In this paper, the general sequence number system is described by the generalised generating
function Sni(z) given by equation (1) for i ranging from unity to infinity. Thus the sequence
number system generated by putting i = 1 is given by Sn1(z)=z/(z+/-1) and those by putting i =2
is given by Sn2(z)=z^2/(z^2+/-1) and so on.
...................................................................i
.................................................................z
............................................Sni(z):=..---------------.............(1).
..............................................................i
...........................................................z...+/-...1
2. Factorisation Of Sequence Numbers
For each fixed index value of i, we can expand Sni(z) into a normalised sequence with uniform
intervals of i units. Sequence numbers are formed by arranging finite sequences from expansion
of Sni(z) with ascending number of terms starting from unity as shown in Tables 1a to 3b for
system-1 to system-3. All series expansions are based on the Laurent series form
although the same properties could also be elicited using Taylor's power series form.
(i) System-1; Sn1(z):=z/(z+/-1)
An even generating function generates sequences with positive signed terms. An odd
generating function generates sequences with alternative positive and negative signed terms.
Subsets of sequences generated by the even and odd Sn1(z) are listed in Tables 1a and 1b.
Sequence primes are tagged with asterisks * in these tables. It is observed that for both even
and odd Sn1(z), primes sequences only occur when the number of terms in a sequence equal to
a prime greater than 1.
.....Table 1a - Even sequence number system-1: Sn1(z) = z/(z-1), i.e. i = 1.
.....(Maple program line: Sn1(z) := series(sum(z^i/(z^i-1),i=1..1),z=infinity,ub).
.....Intrinsic sequence primes are those tagged by asterisks with ub = a prime.
..........Actual program line used: sort(factor(sum(1/z^i,i=0..n)));
------------------------------------------------------------------------------------------------------------------
ub=....................................Even algebraic sequence numbers
number of terms..................(Sequence primes are tagged by *).
-------------------------------------------------------------------------------------------------------------------
1............................1
2*..........................1+1/z
3*..........................1+1/z+1/z^2
4............................1+1/z+1/z^2+1/z^3
5*...........................1+1/z+1/z^2+1/z^3+1/z^4
6.............................1+1/z+1/z^2+1/z^3+1/z^4+1/z^5
7*...........................1+1/z+1/z^2+1/z^3+1/z^4+1/z^5+1/z^6
8.............................(not displayed for page economy)
9........................... ..
10......................... ..
11* ...................... ..
12........................ ..
13* ...................... ..
14........................ ..
16........................ ..
17* ...................... ..
19* ..................... ..
23* ...................... ..
................................................................
----------------------------------------------------------------------------------------------------------------------
Table 1b - Odd sequence number system-1: Sn1(z) = z/(z+1), i.e. i = 1.
(Maple program line: Sn1(z) := series(sum(z^i/(z^i+1),i=1..1),z=infinity,ub).
Intrinsic sequence primes are those tagged by asterisks with ub = a prime.
Actual program line used: sort(factor(sum((-1)^i/z^i,i=0..n)));
----------------------------------------------------------------------------------------------------------------------------
ub=.....................................Odd algebraic sequence numbers
number of terms...................(Sequence primes are tagged by asterisks *).
----------------------------------------------------------------------------------------------------------------------------
1.............................1
2*...........................1-1/z
3*...........................1-1/z+1/z^2
4.............................1-1/z+1/z^2-1/z^3
5*...........................1-1/z+1/z^2-1/z^3+1/z^4
6.............................1-1/z+1/z^2-1/z^3+1/z^4-1/z^5
7*...........................1-1/z+1/z^2-1/z^3+1/z^4-1/z^5+1/z^6
8.............................(not displayed for page economy)
9............................. ..
10........................... ..
11* ......................... ..
12........................... ..
13* ......................... ..
14........................... ..
16........................... ..
17* ......................... ..
19* ........................ ..
23* ......................... ..
...................................................................................
---------------------------------------------------------------------------------------------------------------------------
Factorisation of larger sequence numbers may generate type 3 sequence primes which have
irregular intervals and unnormalised sequences. These have not been exhaustively investigated
but here are some examples:
....................Table 1c - A list of irregular sequence primes
...........................selected from sequences by factorising Sn1(z).
--------------------------------------------------------------------------------------------------------------------------
Irregular Intervals:
z^8-z^7+z^5-z^4+z^3-z+1
z^12-z^11+z^9-z^8+z^6-z^4-z+1
z^20-z^19+z^17-z^16+z^14-z^13+z^11-z^10+z^9-z^7+z^6-z^4+z^3-z+1
z^24-z^23+z^19-z^18+z^17-z^16+z^14-z^13+z^12-z^11+z^10-z^8+z^7-z^6+z^5-z+1
z^24-z^23+z^21-z^20+-z^18-z^17+z^15-+z^14+z^12-z^10+z^9-z^7+z^6-z^4-z+z^3-z+1
Irregular Intervals and Unnormalised:
Sn1(z):=sort(factor(z^165/(z^165-1)));
....................165 /..............10......9.....8......7.....6......5......4......3......2
Sn1(z) := z........./..((z - 1) (z ..+ z ..+ z ..+ z ..+ z ..+ z ..+ z ..+ z ..+ z ..+ z ..+ 1)
......................./
........4.....3......2
.....(z ..+ z ..+ z ..+ z ..+ 1)
........40...39....35...34...30...28....25...23....20...17...15...12....10....6.....5
.....(z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ 1)
........2 .................20...19....17....16...14...13...11...10......9.....7......6.....4.....3
.....(z ..+ z ..+ 1) (z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ z ..- z ..+ 1)
........8.....7......5.....4......3.................80....79....78...75...74...73...69...68...67....65
.....(z ..- z ..+ z ..- z ..+ z ..- z ..+ 1) (z ..+ z ..+ z ..- z ..- z ..- z ..- z ..- z ..- z ..+ z
..............64.......63....62...60...59...58...54...53...52....50 .....49......48......47.....46
......+ 2 z ..+ 2 z ..+ z ..- z ..- z ..- z ..- z ..- z ..- z ..+ z ..+ 2 z ..+ 2 z ..+ 2 z ..+ z
...........44...43...42...41...40...39...38...37...36....34......33......32.......31.....30....28
...... - z ..- z ..- z ..- z ..- z ..- z ..- z ..- z ..- z ..+ z ..+ 2 z ..+ 2 z ..+ 2 z ..+ z ..- z
..........27....26...22...21...20...18.....17.......16....15....13...12...11...7.....6.....5......2
......- z ..- z ..- z ..- z ..- z ..+ z ..+ 2 z ..+ 2 z ..+ z ..- z ..- z ..- z ..- z ..- z ..- z ..+ z
......+ z ..+ 1))
-------------------------------------------------------------------------------------------------------------------
(ii) System-2
Tables 2a and 2b show sequence numbers for system-2. The pattern of sequence primes is less
obvious since these are not confined to those with number of terms equal to a prime.
Furthermore, the distribution of sequence primes are not symmetrical, there being more
sequence primes in the odd series than the even series.
Table 2a - Even sequence number system-2: Sn2(z) = z^2/(z^2-1), i.e. i = 2.
.......(Maple program line: Sn2(z) := series(sum(z^i/(z^i-1),i=2..2),z=infinity,ub).
.......Actual program line used: sort(factor(sum(1/z^(2*i),i=0..n)));
---------------------------------------------------------------------------------------------------------------------------
ub.................................................Even algebraic sequence numbers
=number of terms.........................(All sequence primes are tagged with asterisks *)
(Term counts include zeroes).........All without exceptions are sequence primes.
--------------------------------------------------------------------------------------------------------------------------
1........................................1
3*......................................1+1/z^2
5........................................1+1/z^2+1/z^4
7........................................1+1/z^2+1/z^4 +1/z^6
9........................................1+1/z^2+1/z^4 +1/z^6+1/z^8
11......................................1+1/z^2+1/z^4 +1/z^6+1/z^8+1/z^10
13......................................1+1/z^2+1/z^4 +1/z^6+1/z^8+1/z^10+1/z^12
15......................................1+1/z^2+1/z^4 +1/z^6+1/z^8+1/z^10+1/z^12+1/z^14
...................................................................................
-------------------------------------------------------------------------------------------------------------------------
Table 2b - Odd sequence number system-2: Sn2(z) = z^2/(z^2+1), i.e. i = 2.
.........(Maple program line: Sn2(z) := series(sum(z^i/(z^i-1),i=2..2),z=infinity,ub).
.........Actual program line used: sort(factor(sum((-1)*i/z^(2*i),i=0..n)));
---------------------------------------------------------------------------------------------------------------------------
ub................................................Odd algebraic sequence numbers
=number of terms.........................(Odd algebraic sequence numbers are generated by
(Term counts include zeroes).........Sn2(z)=z^2/(z^2-1). These are not shown
--------------------------------------------------------------------------------------------------------------------------
1.........................................1
3.........................................1-1/z^2
5*.......................................1-1/z^2+1/z^4
7.........................................1-1/z^2+1/z^4 -1/z^6
9*.......................................1-1/z^2+1/z^4 -1/z^6+1/z^8
11 ......................................1-1/z^2+1/z^4 -1/z^6+1/z^8-1/z^10
13*.....................................1-1/z^2+1/z^4 -1/z^6+1/z^8-1/z^10+1/z^12
15.......................................1-1/z^2+1/z^4 -1/z^6+1/z^8-1/z^10+1/z^12-1/z^14
21* ....................................(not displayed for page economy)
25* ................................... ..
33* ................................... ..
37* ................................... ..
57* ................................... ..
61* ................................... ..
73* ................................... ..
81* ................................... ..
85* ................................... ..
89 ................................... ..
93* ................................... ..
97 ................................... ..
101.................................. ..
105*.................................. ..
113.................................. ..
117*.................................. ..
121*.................................. ..
-------------------------------------------------------------------------------------------------------------------------
(iii) System-3
The invesitgation was not exhaustive but exploration up to 117 terms (i=39) did not
uncover anymore sequence primes.
Table 3a - Even sequence number system-2: Sn3(z) = z^3/(z^3-1), i.e. i = 3.
.........(Maple program line: Sn2(z) := series(sum(z^i/(z^i-1),i=3..3),z=infinity,ub).
..........Acutal program line used: sort(factor(sum(1/z^(3*i),i=0..n)));
---------------------------------------------------------------------------------------------------------------------------
ub.................................................Even algebraic sequence numbers
=number of terms.........................(All sequence primes are tagged with asterisks *)
(Term counts include zeroes)..........All without exceptions are sequence primes.
--------------------------------------------------------------------------------------------------------------------------
1........................................1
3........................................1+1/z^3
7*......................................1+1/z^3+1/z^6
10......................................1+1/z^3+1/z^6+1/z^9
13......................................1+1/z^3+1/z^6+1/z^9+1/z^12
16......................................1+1/z^3+1/z^6+1/z^9+1/z^12+1/z^15
............Up to i = 39, no more sequence primes have been uncovered.
i=34...................................irregular and unnormalised sequence composite
i=39...................................irregular sequence composite
.....................................................................
-------------------------------------------------------------------------------------------------------------------------
Table 3b - Odd sequence number system-2: Sn3(z) = z^3/(z^3+1), i.e. i = 3.
..........(Maple program line: Sn2(z) := series(sum(z^i/(z^i-1),i=3..3),z=infinity,ub).
..........Actual program line used: sort(factor(sum((-1)^i/z^(3*i),i=0..n)));
---------------------------------------------------------------------------------------------------------------------------
ub.................................................Odd algebraic sequence numbers
=number of terms.........................(All sequence primes are tagged with asterisks *)
(Term counts include zeroes)..........All without exceptions are sequence primes.
--------------------------------------------------------------------------------------------------------------------------
1........................................1
3........................................1-1/z^3
7*......................................1-1/z^3+1/z^6
10......................................1-1/z^3+1/z^6-1/z^9
13......................................1-1/z^3+1/z^6-1/z^9+1/z^12
16......................................1-1/z^3+1/z^6-1/z^9+1/z^12-z^15
............Up to i = 39, no more sequence primes have been uncovered.
i=34...................................irregular and unnormalised sequence composite
i=39...................................irregular sequence composite
.....................................................................
-------------------------------------------------------------------------------------------------------------------------
3. Postulates and Theorems
(i) Postulates
Postulate 1a: A normalised sequence in system-1 which contains p terms
where p is a prime is irreducible. This can be checked using the Maple program line
sort(factor(sum(1/z^i,i=0..p-1))); and sort(factor(sum((-1)^i/z^i,i=0..p-1))) where p is a prime.
Postulate 1b: A normalised sequence which contain p terms with uniform
intervals of p unit where p is a prime is irreducible. This can be checked using the Maple
program line sort(factorsum(1/z^(p*i),i=0..p-1))) and sort(factor(sum((-1)^i/z^(p*i),i=0..p-1)))
where p is a prime.
Remarks: In both Theorems 1a and 1b above, the distributions of primes are symmetrical.
Postulate 2: All number sequences can be reduced to a product of sequence primes.
Postulate 3: There is no end to the number of sequence primes.
(ii) Theorems
Theorem 1: The generating function z^i/(z^i-1) is factorisable for i > 1 and for all
sequence numbers with number of terms greater than two.
Proof: Using a well known algebraic identity given by
(z^i-1) = (z-1)*(z^(i-1)+z^(i-2)+......+z+1)
we show that this generating function for i > 1 is factorisable as follows:
Factor(z^i/(z^i-1)) = z^i/((z-1)*(z^(i-1)+z^(i-2)+......+z+1)).
Only the first two terms of 1 and 1+1/z^i are irreducbile, i.e., sequence primes. Q.E.D.
Theorem 2: Sni(z):=z^i/(z^i-1) can be derived from the equation of divisibles.
Proof:
................................................(2 i)
...............................................z
..........................Sni(z) := -------------- = z^(2*i)* (equation of divisibles) .....(2).
.............................................i....i
...........................................z (z - 1)
................................................................................................................Q.E.D.
Theorem 3: The product of an even generating function and an odd generating function
will generate a normalised sequence with double the intervals.
Proof: An even generating function is given by z^i/(z^i-1) and that for an odd generating
function is given by z^i(z^i+1). The product of the two is given by z^(2*i)/(z^(2*i)-1) which of
course will generate a normalised sequence with doubled the intervals compared to the orginal
generating functions. Q.E.D.
Comment: The well known identity (z^2-1) = (z-1)*(z+1) is the simplest case of this theorem.
4. Conclusions
This paper reports interim findings on sequence primes on system-1, system-2, and system-3
sequence numbers. It is found that all sequence numbers in system-1 which contain the number of terms
equal to a prime are irreducible. This remains an unsolved problem as there is no proof of this.
Just like in the prediction of primes, it is very unlikely that a deterministic formulation could be
found for the global prediction of sequence primes. This is because it is found that factorisation
of larger sequence numbers result in the appearance of irregular sequence primes which are
difficult to charaterise. Nevertheless the findings should fuel interest amongst number theorists
interested in finding explanations for the findings reported in this paper.
5. References
1. Pinter C.C.: A Book Of Abstract Algebra (2nd Edition) Chapter 25, pp 251 to 257.
2. Garret Birkhoff and Sauders MacLano: A survey of modern algebra, (4th Edition), pp435 to
439.